Functions related to sequences

Functions related to sequences

YSQL supports all PostgreSQL-compatible built-in functions and operators. The following are the currently documented ones.

Statement Description
nextval() Returns the next value for the specified sequence in the current session
currval() Returns the value returned by the most recent call to nextval() for the specified sequence in the current session
setval() Set and return the value for for any sequence
lastval() Returns the value returned by the most recent call to nextval() for any sequence