Serial data types

A table can have only one column of the SERIAL data type. It can also have either a SERIAL8 column or a BIGSERIAL column.

When you insert values, specify the value zero for the serial column. The database server generates the next actual value in sequence. Serial columns do not allow NULL values.

You can specify a nonzero value for a serial column (as long as it does not duplicate any existing value in that column), and the database server uses the value. That nonzero value might set a new starting point for values that the database server generates. (The next value the database server generates for you is one greater than the maximum value in the column.)