Get sequence next value
postgres=# CREATE SEQUENCE myseq MINVALUE 0; CREATE SEQUENCE postgres=# -- Incrementing a sequence postgres=# postgres=# SELECT nextval('myseq'); nextval --------- 0 (1 row) postgres=# postgres=# SELECT nextval('myseq'); nextval --------- 1 (1 row) postgres=# postgres=# drop sequence myseq; DROP SEQUENCE postgres=#