pg_sequences
A system view providing human-readable information about sequences
pg_sequences
is a system catalogue view providing human-readable information about sequences. It is based on the underlying system catalogue table pg_sequence
.
pg_sequences
was introduced in PostgreSQL 10.
Notes
Some of the column names returned by pg_sequences
match those contained in the sequence relation prior to PostgreSQL 10. See pg_sequence
for further information.
Definition by PostgreSQL version
pg_sequences (PostgreSQL 15)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
pg_sequences (PostgreSQL 14)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
pg_sequences (PostgreSQL 13)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
pg_sequences (PostgreSQL 12)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
pg_sequences (PostgreSQL 11)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
pg_sequences (PostgreSQL 10)
View "pg_catalog.pg_sequences" Column | Type | Collation | Nullable | Default ---------------+---------+-----------+----------+--------- schemaname | name | | | sequencename | name | | | sequenceowner | name | | | data_type | regtype | | | start_value | bigint | | | min_value | bigint | | | max_value | bigint | | | increment_by | bigint | | | cycle | boolean | | | cache_size | bigint | | | last_value | bigint | | |
Documentation: pg_sequences
Change history
This view has not been modified since it was added in PostgreSQL 10.
- PostgreSQL 10
- added (commit 67dc4ccb)
Examples
postgres=# CREATE SEQUENCE foo_seq; CREATE SEQUENCE postgres=# SELECT * FROM pg_sequences WHERE sequencename='foo_seq'; -[ RECORD 1 ]-+-------------------- schemaname | public sequencename | foo_seq sequenceowner | postgres data_type | bigint start_value | 1 min_value | 1 max_value | 9223372036854775807 increment_by | 1 cycle | f cache_size | 1 last_value |
References
- PostgreSQL documentation: pg_sequences