pg_sequences
是一个提供有关序列的人类可读信息的系统目录视图。它基于底层的系统目录表pg_sequence
。
pg_sequences
在PostgreSQL 10中引入。
注释
某些 pg_sequences
返回的列名与在序列关系中包含的列名匹配,该关系早于PostgreSQL 10。有关更多信息,请参阅pg_sequence
。
按 PostgreSQL 版本定义
pg_sequences (PostgreSQL 17)
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 | | |
文档: pg_sequences
pg_sequences (PostgreSQL 16)
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 | | |
文档: pg_sequences
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 | | |
文档: 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 | | |
文档: 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 | | |
文档: 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 | | |
文档: 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 | | |
文档: 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 | | |
文档: pg_sequences
更改历史记录
自它在PostgreSQL 10中添加以来,此视图没有进行修改。
- PostgreSQL 10
- 添加 (提交 67dc4ccb)
示例
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 |
参考文献
- PostgreSQL 文档: pg_sequences