ALTER PUBLICATION
是用于修改发布的 DDL 命令。
ALTER PUBLICATION
添加于 PostgreSQL 10。
更改历史
- PostgreSQL 15
- PostgreSQL 14
ALTER PUBLICATION ... OWNER TO CURRENT_ROLE
语法已添加 (提交 45b98057)
- PostgreSQL 13
- 参数
publish_via_partition_root
已添加 (提交 83fd4532)
- 参数
- PostgreSQL 10
- 已添加 (提交 665d1fad)
示例
ALTER PUBLICATION
的示例用法
postgres=# ALTER PUBLICATION test_publication RENAME TO foo; ALTER PUBLICATION
将表添加到现有发布
postgres=# ALTER PUBLICATION misc_publication ADD TABLE bar; ALTER PUBLICATION
无法向定义为“FOR ALL TABLES
”的发布添加表或从中删除表。
postgres=# ALTER PUBLICATION test_publication ADD TABLE bar; ERROR: publication "test_publication" is defined as FOR ALL TABLES DETAIL: Tables cannot be added to or dropped from FOR ALL TABLES publications. postgres=# ALTER PUBLICATION test_publication DROP TABLE foo; ERROR: publication "test_publication" is defined as FOR ALL TABLES DETAIL: Tables cannot be added to or dropped from FOR ALL TABLES publications.
尝试更改不存在的发布
postgres=# ALTER PUBLICATION foo RENAME TO bar; ERROR: publication "foo" does not exist
参考文献
- PostgreSQL 文档: ALTER PUBLICATION