Create auto increment field?

Top  Previous  Next

To create a auto incrementing field you simply have to add a new

field to a table of type serial.

 

If you want the new auto incrementing field to be a Primary Key, make sure you

check that option.

 

 

Behind the scenes the serial type creates a sequence and adds a nextval function

to the fields default value.

 

See also:


CREATE SEQUENCE

SEQUENCE MANIPULATION FUNCTIONS

ALTER TABLE