Thread: system maintained keys

system maintained keys

From
"Stefan Lindner"
Date:
Is there any way to get system maintained keys from postgres? e.g. to
have a table with a primary key column (varchar or int) and let postgres
chose the next unique value for this column?



Re: system maintained keys

From
"Oliver Elphick"
Date:
"Stefan Lindner" wrote:
  >Is there any way to get system maintained keys from postgres? e.g. to
  >have a table with a primary key column (varchar or int) and let postgres
  >chose the next unique value for this column?

The SERIAL data type does this.  It is an INTEGER with a sequence attached.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Trust in the LORD, and do good..."        Psalms 37:3