Alter the next BIGSERIAL, SERIAL, or SERIAL8 number

The database server sets the starting value for a BIGSERIAL, SERIAL, or SERIAL8 column when it creates the column (see Use CREATE TABLE). You can use the ALTER TABLE statement later to reset the next value, the value that is used for the next inserted row.

You can set the next value to any value higher than the current maximum. Doing this will create gaps in the sequence.

If you try to set the next value to a value smaller than the highest value currently in the column you will not get an error but the value will not be set. Allowing the next value to be set lower than some values in the column would cause duplicate values in some situations and is therefore not allowed.