PostgreSQL Sequence Functions
Sequences, also known as sequence generators or sequence objects, are generally used to generate unique identifiers for rows in a table. This page organizes functions for manipulating PostgreSQL sequences.
-
currval
The PostgreSQLcurrval()
function returns the current value of the specified sequence in the current session. -
lastval
The PostgreSQLlastval()
function returns the result of the most recentnextval()
function. -
nextval
The PostgreSQLnextval()
function advances the specified sequence to its next value and returns that value. -
setval
The PostgreSQLsetval()
function resets the current value of the specified sequence and returns the specified value.