1DROP SUBSCRIPTION(7)     PostgreSQL 15.4 Documentation    DROP SUBSCRIPTION(7)
2
3
4

NAME

6       DROP_SUBSCRIPTION - remove a subscription
7

SYNOPSIS

9       DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]
10

DESCRIPTION

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

PARAMETERS

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

NOTES

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, first disable the
39       subscription by executing ALTER SUBSCRIPTION ... DISABLE, and then
40       disassociate it from the replication slot by executing ALTER
41       SUBSCRIPTION ... SET (slot_name = NONE). After that, DROP SUBSCRIPTION
42       will no longer attempt any actions on a remote host. Note that if the
43       remote replication slot still exists, it (and any related table
44       synchronization slots) should then be dropped manually; otherwise
45       it/they will continue to reserve WAL and might eventually cause the
46       disk to fill up. See also Section 31.2.1.
47
48       If a subscription is associated with a replication slot, then DROP
49       SUBSCRIPTION cannot be executed inside a transaction block.
50

EXAMPLES

52       Drop a subscription:
53
54           DROP SUBSCRIPTION mysub;
55

COMPATIBILITY

57       DROP SUBSCRIPTION is a PostgreSQL extension.
58

SEE ALSO

60       CREATE SUBSCRIPTION (CREATE_SUBSCRIPTION(7)), ALTER SUBSCRIPTION
61       (ALTER_SUBSCRIPTION(7))
62
63
64
65PostgreSQL 15.4                      2023                 DROP SUBSCRIPTION(7)
Impressum