postgresql sequence operation

postgresql use serial as sequence type.
It conveniently generate a sequence named $tablename_$columnname_seq by default, which I think is so easy to use.

set current value for sequence

SELECT setval('sequence_name', 21, true);

For which the last parameter true is the tag for first use; if true, it cannot be used as sequencer.


postgresql sequence operation
https://rug.al/2014/2014-05-03-postgresql-sequence-operation/
Author
Rugal Bernstein
Posted on
May 3, 2014
Licensed under