Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The most important part of this is the definition of mytableid:

  • serial tells it isn't a real datatype.  It's just a signal to do this:
    • use an integer for storage
    • create a SEQUENCE called mytable_mytableid_seq
    • set the default value for the field as nextval('mytable_mytableid_seq')
    • set the sequence attribute of the field to match
    • associate the SEQUENCE with the TABLE (so it's dropped if the table is dropped)
  • PRIMARY KEY tells it to create a primary key constraint called mytable_pkey with mytableid as the only component

...