]> begriffs open source - ai-pg/blob - full-docs/txt/sql-dropsubscription.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / sql-dropsubscription.txt
1
2 DROP SUBSCRIPTION
3
4    DROP SUBSCRIPTION — remove a subscription
5
6 Synopsis
7
8 DROP SUBSCRIPTION [ IF EXISTS ] name [ CASCADE | RESTRICT ]
9
10 Description
11
12    DROP SUBSCRIPTION removes a subscription from the database cluster.
13
14    To execute this command the user must be the owner of the subscription.
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
20 Parameters
21
22    name
23           The name of a subscription to be dropped.
24
25    CASCADE
26           RESTRICT
27           These key words do not have any effect, since there are no
28           dependencies on subscriptions.
29
30 Notes
31
32    When dropping a subscription that is associated with a replication slot
33    on the remote host (the normal state), DROP SUBSCRIPTION will connect
34    to the remote host and try to drop the replication slot (and any
35    remaining table synchronization slots) as part of its operation. This
36    is necessary so that the resources allocated for the subscription on
37    the remote host are released. If this fails, either because the remote
38    host is not reachable or because the remote replication slot cannot be
39    dropped or does not exist or never existed, the DROP SUBSCRIPTION
40    command will fail. To proceed in this situation, first disable the
41    subscription by executing ALTER SUBSCRIPTION ... DISABLE, and then
42    disassociate it from the replication slot by executing ALTER
43    SUBSCRIPTION ... SET (slot_name = NONE). After that, DROP SUBSCRIPTION
44    will no longer attempt any actions on a remote host. Note that if the
45    remote replication slot still exists, it (and any related table
46    synchronization slots) should then be dropped manually; otherwise
47    it/they will continue to reserve WAL and might eventually cause the
48    disk to fill up. See also Section 29.2.1.
49
50    If a subscription is associated with a replication slot, then DROP
51    SUBSCRIPTION cannot be executed inside a transaction block.
52
53 Examples
54
55    Drop a subscription:
56 DROP SUBSCRIPTION mysub;
57
58 Compatibility
59
60    DROP SUBSCRIPTION is a PostgreSQL extension.
61
62 See Also
63
64    CREATE SUBSCRIPTION, ALTER SUBSCRIPTION