pg_publication
是一个存储数据库中创建的所有发布的系统目录表。
pg_publication
在PostgreSQL 10 中添加。
各个表通过pg_publication_rel
表与订阅关联。
psql 命令
\dRp[+]
- 列出可用的发布
按 PostgreSQL 版本定义
pg_publication (PostgreSQL 17)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | pubviaroot | boolean | | not null | Indexes: "pg_publication_oid_index" PRIMARY KEY, btree (oid) "pg_publication_pubname_index" UNIQUE CONSTRAINT, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 16)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | pubviaroot | boolean | | not null | Indexes: "pg_publication_oid_index" PRIMARY KEY, btree (oid) "pg_publication_pubname_index" UNIQUE CONSTRAINT, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 15)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | pubviaroot | boolean | | not null | Indexes: "pg_publication_oid_index" PRIMARY KEY, btree (oid) "pg_publication_pubname_index" UNIQUE CONSTRAINT, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 14)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | pubviaroot | boolean | | not null | Indexes: "pg_publication_oid_index" PRIMARY KEY, btree (oid) "pg_publication_pubname_index" UNIQUE CONSTRAINT, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 13)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | pubviaroot | boolean | | not null | Indexes: "pg_publication_oid_index" UNIQUE, btree (oid) "pg_publication_pubname_index" UNIQUE, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 12)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- oid | oid | | not null | pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | Indexes: "pg_publication_oid_index" UNIQUE, btree (oid) "pg_publication_pubname_index" UNIQUE, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 11)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | pubtruncate | boolean | | not null | Indexes: "pg_publication_oid_index" UNIQUE, btree (oid) "pg_publication_pubname_index" UNIQUE, btree (pubname)
文档: pg_publication
pg_publication (PostgreSQL 10)
Table "pg_catalog.pg_publication" Column | Type | Collation | Nullable | Default --------------+---------+-----------+----------+--------- pubname | name | | not null | pubowner | oid | | not null | puballtables | boolean | | not null | pubinsert | boolean | | not null | pubupdate | boolean | | not null | pubdelete | boolean | | not null | Indexes: "pg_publication_oid_index" UNIQUE, btree (oid) "pg_publication_pubname_index" UNIQUE, btree (pubname)
文档: pg_publication
更改历史记录
- PostgreSQL 13
- 添加列
pubviaroot
(提交83fd4532)
- 添加列
- PostgreSQL 11
- 添加列
pubtruncate
(提交039eb6e9)
- 添加列
- PostgreSQL 10
- 添加 (提交665d1fad)
示例
postgres=# CREATE PUBLICATION test_publication FOR TABLE foo; CREATE PUBLICATION postgres=# SELECT * FROM pg_publication\gx -[ RECORD 1 ]+----------------- oid | 91147 pubname | test_publication pubowner | 10 puballtables | f pubinsert | t pubupdate | t pubdelete | t pubtruncate | t pubviaroot | f postgres=# \dRp List of publications Name | Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root ------------------+----------+------------+---------+---------+---------+-----------+---------- test_publication | postgres | f | t | t | t | t | f (1 row) postgres=# \dRp+ Publication test_publication Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root ----------+------------+---------+---------+---------+-----------+---------- postgres | f | t | t | t | t | f Tables: "public.foo"
参考
- PostgreSQL 文档: pg_publication