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