]> begriffs open source - ai-pg/blob - full-docs/man7/DROP_SUBSCRIPTION.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / DROP_SUBSCRIPTION.7
1 '\" t
2 .\"     Title: DROP SUBSCRIPTION
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP SUBSCRIPTION" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_SUBSCRIPTION \- remove a subscription
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP SUBSCRIPTION [ IF EXISTS ] \fIname\fR [ CASCADE | RESTRICT ]
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBDROP SUBSCRIPTION\fR
40 removes a subscription from the database cluster\&.
41 .PP
42 To execute this command the user must be the owner of the subscription\&.
43 .PP
44 \fBDROP SUBSCRIPTION\fR
45 cannot be executed inside a transaction block if the subscription is associated with a replication slot\&. (You can use
46 \fBALTER SUBSCRIPTION\fR
47 to unset the slot\&.)
48 .SH "PARAMETERS"
49 .PP
50 \fIname\fR
51 .RS 4
52 The name of a subscription to be dropped\&.
53 .RE
54 .PP
55 CASCADE
56 .br
57 RESTRICT
58 .RS 4
59 These key words do not have any effect, since there are no dependencies on subscriptions\&.
60 .RE
61 .SH "NOTES"
62 .PP
63 When dropping a subscription that is associated with a replication slot on the remote host (the normal state),
64 \fBDROP SUBSCRIPTION\fR
65 will connect to the remote host and try to drop the replication slot (and any remaining table synchronization slots) as part of its operation\&. This is necessary so that the resources allocated for the subscription on the remote host are released\&. If this fails, either because the remote host is not reachable or because the remote replication slot cannot be dropped or does not exist or never existed, the
66 \fBDROP SUBSCRIPTION\fR
67 command will fail\&. To proceed in this situation, first disable the subscription by executing
68 ALTER SUBSCRIPTION \&.\&.\&. DISABLE, and then disassociate it from the replication slot by executing
69 ALTER SUBSCRIPTION \&.\&.\&. SET (slot_name = NONE)\&. After that,
70 \fBDROP SUBSCRIPTION\fR
71 will no longer attempt any actions on a remote host\&. Note that if the remote replication slot still exists, it (and any related table synchronization slots) should then be dropped manually; otherwise it/they will continue to reserve WAL and might eventually cause the disk to fill up\&. See also
72 Section\ \&29.2.1\&.
73 .PP
74 If a subscription is associated with a replication slot, then
75 \fBDROP SUBSCRIPTION\fR
76 cannot be executed inside a transaction block\&.
77 .SH "EXAMPLES"
78 .PP
79 Drop a subscription:
80 .sp
81 .if n \{\
82 .RS 4
83 .\}
84 .nf
85 DROP SUBSCRIPTION mysub;
86 .fi
87 .if n \{\
88 .RE
89 .\}
90 .SH "COMPATIBILITY"
91 .PP
92 \fBDROP SUBSCRIPTION\fR
93 is a
94 PostgreSQL
95 extension\&.
96 .SH "SEE ALSO"
97 CREATE SUBSCRIPTION (\fBCREATE_SUBSCRIPTION\fR(7)), ALTER SUBSCRIPTION (\fBALTER_SUBSCRIPTION\fR(7))