pg_drop_replication_slot()

用于删除复制槽的函数

pg_drop_replication_slot() 是一个系统函数,用于删除物理复制槽或逻辑复制槽

pg_drop_replication_slot()PostgreSQL 9.4 中添加。

用法

pg_drop_replication_slot ( slot_name name ) → void

要删除的复制槽必须处于非活动状态才能被删除。无法强制删除活动的复制槽。

变更历史

示例

使用 pg_drop_replication_slot() 删除复制槽

postgres=# SELECT pg_drop_replication_slot('node2');
 pg_drop_replication_slot 
--------------------------
 
(1 row)

无法删除活动的复制槽

postgres=# SELECT slot_name, slot_type, active FROM pg_replication_slots;
 slot_name | slot_type | active 
-----------+-----------+--------
 node2     | physical  | t
(1 row)

postgres=# SELECT pg_drop_replication_slot('node2');
ERROR:  replication slot "node2" is active for PID 17675

尝试删除不存在的复制槽

postgres=# SELECT pg_drop_replication_slot('foo');
ERROR:  replication slot "foo" does not exist

分类

复制, 复制槽, 系统函数, WAL

另请参阅

pg_create_physical_replication_slot(), pg_create_logical_replication_slot(), pg_replication_slots

反馈

请在此处提交关于“pg_drop_replication_slot()”的任何评论、建议或更正。