PostgreSQL

Resetting PostgreSQL Sequence

February 21, 2015 by

Okay folks, this is going to be a short one! Sometimes you may want to reset a PostgreSQL sequence, for instance after removing data from a tabel. You can do this very easily by executing the following statement: ALTER SEQUENCE company_id_seq RESTART WITH 1; company_id_seq is the name of the sequence that you want to… read more