NEXTVAL Function
Return the next value for the specified sequence. The
return type is BIGINT
.
NEXTVAL('sequence_name')
You must specify the name of the sequence, using single quotes.
For example, the following ALTER SEQUENCE command restarts the
matchid
sequence. Then the SELECT statement returns the next value for the
sequence:premdb=# alter sequence matchid restart;
ALTER SEQUENCE
premdb=# select nextval('matchid');
nextval
---------
3071
(1 row)
premdb=# select nextval('matchid');
nextval
---------
4095
(1 row)
The system guarantees uniqueness of all generated sequence values.
You cannot use the NEXTVAL
function or run an ALTER
SEQUENCE
command on a database that is in HOT_STANDBY
mode.
Note: Yellowbrick does not support other sequence functions such as
CURRVAL
, LASTVAL
, and SETVAL
.