2 doc/src/sgml/ref/drop_subscription.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-DROPSUBSCRIPTION">
7 <indexterm zone="sql-dropsubscription">
8 <primary>DROP SUBSCRIPTION</primary>
12 <refentrytitle>DROP SUBSCRIPTION</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
18 <refname>DROP SUBSCRIPTION</refname>
19 <refpurpose>remove a subscription</refpurpose>
24 DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ CASCADE | RESTRICT ]
29 <title>Description</title>
32 <command>DROP SUBSCRIPTION</command> removes a subscription from the
37 A subscription can only be dropped by a superuser.
41 <command>DROP SUBSCRIPTION</command> cannot be executed inside a
42 transaction block if the subscription is associated with a replication
43 slot. (You can use <command>ALTER SUBSCRIPTION</command> to unset the
49 <title>Parameters</title>
53 <term><replaceable class="parameter">name</replaceable></term>
56 The name of a subscription to be dropped.
62 <term><literal>CASCADE</literal></term>
63 <term><literal>RESTRICT</literal></term>
67 These key words do not have any effect, since there are no dependencies
80 When dropping a subscription that is associated with a replication slot on
81 the remote host (the normal state), <command>DROP SUBSCRIPTION</command>
82 will connect to the remote host and try to drop the replication slot as
83 part of its operation. This is necessary so that the resources allocated
84 for the subscription on the remote host are released. If this fails,
85 either because the remote host is not reachable or because the remote
86 replication slot cannot be dropped or does not exist or never existed,
87 the <command>DROP SUBSCRIPTION</command> command will fail. To proceed in
88 this situation, disassociate the subscription from the replication slot by
89 executing <literal>ALTER SUBSCRIPTION ... SET (slot_name = NONE)</literal>.
90 After that, <command>DROP SUBSCRIPTION</command> will no longer attempt any
91 actions on a remote host. Note that if the remote replication slot still
92 exists, it should then be dropped manually; otherwise it will continue to
93 reserve WAL and might eventually cause the disk to fill up. See
94 also <xref linkend="logical-replication-subscription-slot">.
99 <title>Examples</title>
104 DROP SUBSCRIPTION mysub;
111 <title>Compatibility</title>
114 <command>DROP SUBSCRIPTION</command> is a <productname>PostgreSQL</>
120 <title>See Also</title>
122 <simplelist type="inline">
123 <member><xref linkend="sql-createsubscription"></member>
124 <member><xref linkend="sql-altersubscription"></member>