]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/drop_subscription.sgml
Trim trailing whitespace
[postgresql] / doc / src / sgml / ref / drop_subscription.sgml
1 <!--
2 doc/src/sgml/ref/drop_subscription.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="SQL-DROPSUBSCRIPTION">
7  <indexterm zone="sql-dropsubscription">
8   <primary>DROP SUBSCRIPTION</primary>
9  </indexterm>
10
11  <refmeta>
12   <refentrytitle>DROP SUBSCRIPTION</refentrytitle>
13   <manvolnum>7</manvolnum>
14   <refmiscinfo>SQL - Language Statements</refmiscinfo>
15  </refmeta>
16
17  <refnamediv>
18   <refname>DROP SUBSCRIPTION</refname>
19   <refpurpose>remove a subscription</refpurpose>
20  </refnamediv>
21
22  <refsynopsisdiv>
23 <synopsis>
24 DROP SUBSCRIPTION [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [ CASCADE | RESTRICT ]
25 </synopsis>
26  </refsynopsisdiv>
27
28  <refsect1>
29   <title>Description</title>
30
31   <para>
32    <command>DROP SUBSCRIPTION</command> removes a subscription from the
33    database cluster.
34   </para>
35
36   <para>
37    A subscription can only be dropped by a superuser.
38   </para>
39
40   <para>
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
44    slot.)
45   </para>
46  </refsect1>
47
48  <refsect1>
49   <title>Parameters</title>
50
51   <variablelist>
52    <varlistentry>
53     <term><replaceable class="parameter">name</replaceable></term>
54     <listitem>
55      <para>
56       The name of a subscription to be dropped.
57      </para>
58     </listitem>
59    </varlistentry>
60
61    <varlistentry>
62     <term><literal>CASCADE</literal></term>
63     <term><literal>RESTRICT</literal></term>
64
65     <listitem>
66      <para>
67       These key words do not have any effect, since there are no dependencies
68       on subscriptions.
69      </para>
70     </listitem>
71    </varlistentry>
72
73   </variablelist>
74  </refsect1>
75
76  <refsect1>
77   <title>Notes</title>
78
79   <para>
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">.
95   </para>
96  </refsect1>
97
98  <refsect1>
99   <title>Examples</title>
100
101   <para>
102    Drop a subscription:
103 <programlisting>
104 DROP SUBSCRIPTION mysub;
105 </programlisting>
106   </para>
107
108  </refsect1>
109
110  <refsect1>
111   <title>Compatibility</title>
112
113   <para>
114    <command>DROP SUBSCRIPTION</command> is a <productname>PostgreSQL</>
115    extension.
116   </para>
117  </refsect1>
118
119  <refsect1>
120   <title>See Also</title>
121
122   <simplelist type="inline">
123    <member><xref linkend="sql-createsubscription"></member>
124    <member><xref linkend="sql-altersubscription"></member>
125   </simplelist>
126  </refsect1>
127 </refentry>