select open change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

FUNCTIONS / SEQUENCE MANIPULATION FUNCTIONS

pg_get_sequence_data

Read PG 20 devel manual ↗

Returns information about the sequence.

Development snapshot. These definitions may change before release.

Signatures & examples

pg_get_sequence_data ( regclass ) → record ( last_value bigint, is_called bool, page_lsn pg_lsn )
Returns information about the sequence. last_value is the last sequence value written to disk. If caching is used, this value can be greater than the last value handed out from the sequence. is_called indicates whether the sequence has been used. page_lsn is the LSN corresponding to the most recent WAL record that modified this sequence relation. This function returns a row of NULL values if the specified relation OID does not exist, if it is not a sequence, if the current user lacks SELECT privilege on the sequence, if the sequence is another session's temporary sequence, or if it is an unlogged sequence on a standby server.
Version history 1
  1. PG 18 → 19added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source