]> begriffs open source - ai-pg/blob - full-docs/html/sql-dropsubscription.html
Include latest toc output
[ai-pg] / full-docs / html / sql-dropsubscription.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>DROP SUBSCRIPTION</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-dropstatistics.html" title="DROP STATISTICS" /><link rel="next" href="sql-droptable.html" title="DROP TABLE" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">DROP SUBSCRIPTION</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-dropstatistics.html" title="DROP STATISTICS">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-droptable.html" title="DROP TABLE">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-DROPSUBSCRIPTION"><div class="titlepage"></div><a id="id-1.9.3.133.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">DROP SUBSCRIPTION</span></h2><p>DROP SUBSCRIPTION — remove a subscription</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
3 DROP SUBSCRIPTION [ IF EXISTS ] <em class="replaceable"><code>name</code></em> [ CASCADE | RESTRICT ]
4 </pre></div><div class="refsect1" id="id-1.9.3.133.5"><h2>Description</h2><p>
5    <code class="command">DROP SUBSCRIPTION</code> removes a subscription from the
6    database cluster.
7   </p><p>
8    To execute this command the user must be the owner of the subscription.
9   </p><p>
10    <code class="command">DROP SUBSCRIPTION</code> cannot be executed inside a
11    transaction block if the subscription is associated with a replication
12    slot.  (You can use <a class="link" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION"><code class="command">ALTER SUBSCRIPTION</code></a> to unset the
13    slot.)
14   </p></div><div class="refsect1" id="id-1.9.3.133.6"><h2>Parameters</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>
15       The name of a subscription to be dropped.
16      </p></dd><dt><span class="term"><code class="literal">CASCADE</code><br /></span><span class="term"><code class="literal">RESTRICT</code></span></dt><dd><p>
17       These key words do not have any effect, since there are no dependencies
18       on subscriptions.
19      </p></dd></dl></div></div><div class="refsect1" id="id-1.9.3.133.7"><h2>Notes</h2><p>
20    When dropping a subscription that is associated with a replication slot on
21    the remote host (the normal state), <code class="command">DROP SUBSCRIPTION</code>
22    will connect to the remote host and try to drop the replication slot (and
23    any remaining table synchronization slots) as
24    part of its operation.  This is necessary so that the resources allocated
25    for the subscription on the remote host are released.  If this fails,
26    either because the remote host is not reachable or because the remote
27    replication slot cannot be dropped or does not exist or never existed,
28    the <code class="command">DROP SUBSCRIPTION</code> command will fail.  To proceed
29    in this situation, first disable the subscription by executing
30    <a class="link" href="sql-altersubscription.html#SQL-ALTERSUBSCRIPTION-PARAMS-DISABLE">
31    <code class="literal">ALTER SUBSCRIPTION ... DISABLE</code></a>, and then disassociate
32    it from the replication slot by executing
33    <a class="link" href="sql-altersubscription.html#SQL-ALTERSUBSCRIPTION-PARAMS-SET">
34    <code class="literal">ALTER SUBSCRIPTION ... SET (slot_name = NONE)</code></a>.
35    After that, <code class="command">DROP SUBSCRIPTION</code> will no longer attempt any
36    actions on a remote host.  Note that if the remote replication slot still
37    exists, it (and any related table synchronization slots) should then be
38    dropped manually; otherwise it/they will continue to
39    reserve WAL and might eventually cause the disk to fill up.  See
40    also <a class="xref" href="logical-replication-subscription.html#LOGICAL-REPLICATION-SUBSCRIPTION-SLOT" title="29.2.1. Replication Slot Management">Section 29.2.1</a>.
41   </p><p>
42    If a subscription is associated with a replication slot, then <code class="command">DROP
43    SUBSCRIPTION</code> cannot be executed inside a transaction block.
44   </p></div><div class="refsect1" id="id-1.9.3.133.8"><h2>Examples</h2><p>
45    Drop a subscription:
46 </p><pre class="programlisting">
47 DROP SUBSCRIPTION mysub;
48 </pre></div><div class="refsect1" id="id-1.9.3.133.9"><h2>Compatibility</h2><p>
49    <code class="command">DROP SUBSCRIPTION</code> is a <span class="productname">PostgreSQL</span>
50    extension.
51   </p></div><div class="refsect1" id="id-1.9.3.133.10"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION"><span class="refentrytitle">CREATE SUBSCRIPTION</span></a>, <a class="xref" href="sql-altersubscription.html" title="ALTER SUBSCRIPTION"><span class="refentrytitle">ALTER SUBSCRIPTION</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-dropstatistics.html" title="DROP STATISTICS">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-droptable.html" title="DROP TABLE">Next</a></td></tr><tr><td width="40%" align="left" valign="top">DROP STATISTICS </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> DROP TABLE</td></tr></table></div></body></html>