Home Explore Blog CI



postgresql

1st chunk of `doc/src/sgml/ref/alter_subscription.sgml`
80a35bc15bc95bd65bda4c1674fa6a70d855b408339c75d10000000100000fa4
<!--
doc/src/sgml/ref/alter_subscription.sgml
PostgreSQL documentation
-->

<refentry id="sql-altersubscription">
 <indexterm zone="sql-altersubscription">
  <primary>ALTER SUBSCRIPTION</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>ALTER SUBSCRIPTION</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>ALTER SUBSCRIPTION</refname>
  <refpurpose>change the definition of a subscription</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> CONNECTION '<replaceable>conninfo</replaceable>'
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ADD PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DROP PUBLICATION <replaceable class="parameter">publication_name</replaceable> [, ...] [ WITH ( <replaceable class="parameter">publication_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> REFRESH PUBLICATION [ WITH ( <replaceable class="parameter">refresh_option</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] ) ]
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> ENABLE
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> DISABLE
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SET ( <replaceable class="parameter">subscription_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> SKIP ( <replaceable class="parameter">skip_option</replaceable> = <replaceable class="parameter">value</replaceable> )
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER SUBSCRIPTION <replaceable class="parameter">name</replaceable> RENAME TO <replaceable>new_name</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>ALTER SUBSCRIPTION</command> can change most of the subscription
   properties that can be specified
   in <xref linkend="sql-createsubscription"/>.
  </para>

  <para>
   You must own the subscription to use <command>ALTER SUBSCRIPTION</command>.
   To rename a subscription or alter the owner, you must have
   <literal>CREATE</literal> permission on the database. In addition,
   to alter the owner, you must be able to <literal>SET ROLE</literal> to the
   new owning role. If the subscription has
   <literal>password_required=false</literal>, only superusers can modify it.
  </para>

  <para>
   When refreshing a publication we remove the relations that are no longer
   part of the publication and we also remove the table synchronization slots
   if there are any. It is necessary to remove these slots so that the resources
   allocated for the subscription on the remote host are released. If due to
   network breakdown or some other error, <productname>PostgreSQL</productname>
   is unable to remove the slots, an error will be reported. To proceed in this
   situation, the user either needs to retry the operation or disassociate the
   slot from the subscription and drop the subscription as explained in
   <xref linkend="sql-dropsubscription"/>.
  </para>

  <para>
   Commands <command>ALTER

Title: ALTER SUBSCRIPTION
Summary
This section of the PostgreSQL documentation describes the ALTER SUBSCRIPTION command, which allows modifications to the definition of an existing subscription. It details the various parameters that can be altered, including the connection string, publication list, and other subscription properties. It also covers the required permissions for using the command, such as ownership of the subscription and CREATE permission on the database. It also explains how refreshing a publication removes relations and table synchronization slots, and how to handle errors during slot removal.