Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

At the same time I like MS better in some ways for the same issue because it has auto_increment instead and it is almost all I ever need and it would be a drag to have to use an extra table (not sure it's a full fledged table, but you get the idea) every time.

It's not any kind of a table, it's a sequence, which consumes only a handful of bytes, pretty much exactly like auto_increment does. The big advantage of a sequence over auto_increment is that if you need to you can use more than one sequence in the same table, or share a sequence between tables, which you can't do with MySQL (or couldn't do the last time I looked at it anyway)...

The same goes for the data type ENUM (not sure if PS has SET).

Not sure what you mean by the ENUM, since PostgreSQL does indeed have ENUM, just not in the backwards column-level way MySQL does it, which forces you to redefine the enum in every column you want to use it, even if it should be the same for all those columns.

# MySQL CREATE TABLE color_choices ( foreground ENUM ( 'RED', 'GREEN', 'BLUE' ), background ENUM ( 'RED', 'GREEN', 'BLUE' ) ); # PostgreSQL CREATE TYPE colors AS ENUM ( 'RED', 'GREEN', 'BLUE' ); CREATE TABLE color_choices ( foreground colors, background colors );

And while PostgreSQL doesn't have SET, it does support array data types, which get you pretty much the same end result, with less work.

# MySQL CREATE TABLE color_choices ( favorites SET ( 'RED', 'GREEN', 'BLUE' ), least_favorites SET ( 'RED', 'GREEN', 'BLUE' ) ); # PostgreSQL CREATE TYPE colors AS ENUM ( 'RED', 'GREEN', 'BLUE' ); CREATE TABLE color_choices ( favorites colors[], least_favorites colors[] );

Also, if you like SET, you should be sure and read The MySQL SET Data Type, especially the section entitled "Why You Shouldn't Use SET".
We're not surrounded, we're in a target-rich environment!

In reply to Re^3: [OT] Why I don't use Mysql for new projects by jasonk
in thread [OT] Why I don't use Mysql for new projects by moritz

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (6)
    As of 2018-06-22 19:45 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (124 votes). Check out past polls.