pg_sequences
是一个提供关于序列的人类可读信息的系统目录视图。它基于底层的系统目录表 pg_sequence
。
pg_sequences
在 PostgreSQL 10 中引入。
注释
一些由 pg_sequences
返回的列名与在 序列关系 中包含的列名匹配,在 PostgreSQL 10 之前。有关更多信息,请参阅 pg_sequence
。
按PostgreSQL版本定义
pg_sequences (PostgreSQL 18)
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 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