此条目涉及一项 PostgreSQL 功能,该功能是 PostgreSQL 19 的一部分,预计将于 2026 年底发布。
pg_publication_sequences
是一个 系统目录 视图,列出了 发布 与相关序列之间的映射。
pg_publication_sequences
在 PostgreSQL 19 中添加。
按 PostgreSQL 版本定义
pg_publication_sequences (PostgreSQL 19)
View "pg_catalog.pg_publication_sequences" Column | Type | Collation | Nullable | Default --------------+------+-----------+----------+--------- pubname | name | | | schemaname | name | | | sequencename | name | | |
变更历史
- PostgreSQL 19
- 添加(提交 d0a89683)
示例
pg_publication_sequences
的基本用法示例
postgres=# CREATE TABLE foo (id serial, val text); CREATE TABLE postgres=# CREATE PUBLICATION misc_publication FOR ALL SEQUENCES; CREATE PUBLICATION postgres=# SELECT * FROM pg_publication_sequences ; pubname | schemaname | sequencename ------------------+------------+-------------- misc_publication | public | foo_id_seq (1 row) postgres=# \d+ foo_id_seq Sequence "public.foo_id_seq" Type | Start | Minimum | Maximum | Increment | Cycles? | Cache ---------+-------+---------+------------+-----------+---------+------- integer | 1 | 1 | 2147483647 | 1 | no | 1 Owned by: public.foo.id Publications: "misc_publication"
参考资料
- PostgreSQL 19 文档: pg_publication_sequences