1DROP SUBSCRIPTION(7) PostgreSQL 14.3 Documentation DROP SUBSCRIPTION(7)
2
3
4
6 DROP_SUBSCRIPTION - remove a subscription
7
9 DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]
10
12 DROP SUBSCRIPTION removes a subscription from the database cluster.
13
14 A subscription can only be dropped by a superuser.
15
16 DROP SUBSCRIPTION cannot be executed inside a transaction block if the
17 subscription is associated with a replication slot. (You can use ALTER
18 SUBSCRIPTION to unset the slot.)
19
21 name
22 The name of a subscription to be dropped.
23
24 CASCADE
25 RESTRICT
26 These key words do not have any effect, since there are no
27 dependencies on subscriptions.
28
30 When dropping a subscription that is associated with a replication slot
31 on the remote host (the normal state), DROP SUBSCRIPTION will connect
32 to the remote host and try to drop the replication slot (and any
33 remaining table synchronization slots) as part of its operation. This
34 is necessary so that the resources allocated for the subscription on
35 the remote host are released. If this fails, either because the remote
36 host is not reachable or because the remote replication slot cannot be
37 dropped or does not exist or never existed, the DROP SUBSCRIPTION
38 command will fail. To proceed in this situation, disassociate the
39 subscription from the replication slot by executing ALTER SUBSCRIPTION
40 ... SET (slot_name = NONE). After that, DROP SUBSCRIPTION will no
41 longer attempt any actions on a remote host. Note that if the remote
42 replication slot still exists, it (and any related table
43 synchronization slots) should then be dropped manually; otherwise
44 it/they will continue to reserve WAL and might eventually cause the
45 disk to fill up. See also Section 31.2.1.
46
47 If a subscription is associated with a replication slot, then DROP
48 SUBSCRIPTION cannot be executed inside a transaction block.
49
51 Drop a subscription:
52
53 DROP SUBSCRIPTION mysub;
54
56 DROP SUBSCRIPTION is a PostgreSQL extension.
57
59 CREATE SUBSCRIPTION (CREATE_SUBSCRIPTION(7)), ALTER SUBSCRIPTION
60 (ALTER_SUBSCRIPTION(7))
61
62
63
64PostgreSQL 14.3 2022 DROP SUBSCRIPTION(7)