Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_publication.sgml`
f36c76385507fa5b0652e42ea63973764a902cc7c1a2b3130000000100000d86
 TABLE</literal></link>/
   <literal>ADD TABLE</literal>, and the combination of <literal>DROP</literal>
   with a <literal>WHERE</literal> clause is not allowed.
  </para>

  <para>
   The fourth variant of this command listed in the synopsis can change
   all of the publication properties specified in
   <xref linkend="sql-createpublication"/>.  Properties not mentioned in the
   command retain their previous settings.
  </para>

  <para>
   The remaining variants change the owner and the name of the publication.
  </para>

  <para>
   You must own the publication to use <command>ALTER PUBLICATION</command>.
   Adding a table to a publication additionally requires owning that table.
   The <literal>ADD TABLES IN SCHEMA</literal> and
   <literal>SET TABLES IN SCHEMA</literal> to a publication requires the
   invoking user to be a superuser.
   To alter the owner, you must be able to <literal>SET ROLE</literal> to the
   new owning role, and that role must have <literal>CREATE</literal>
   privilege on the database.
   Also, the new owner of a
   <link linkend="sql-createpublication-params-for-all-tables"><literal>FOR ALL TABLES</literal></link>
   or <link linkend="sql-createpublication-params-for-tables-in-schema"><literal>FOR TABLES IN SCHEMA</literal></link>
   publication must be a superuser. However, a superuser can
   change the ownership of a publication regardless of these restrictions.
  </para>

  <para>
   Adding/Setting any schema when the publication also publishes a table with a
   column list, and vice versa is not supported.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="parameter">name</replaceable></term>
    <listitem>
     <para>
      The name of an existing publication whose definition is to be altered.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">table_name</replaceable></term>
    <listitem>
     <para>
      Name of an existing table.  If <literal>ONLY</literal> is specified before the
      table name, only that table is affected.  If <literal>ONLY</literal> is not
      specified, the table and all its descendant tables (if any) are
      affected.  Optionally, <literal>*</literal> can be specified after the table
      name to explicitly indicate that descendant tables are included.
     </para>

     <para>
      Optionally, a column list can be specified.  See <xref
      linkend="sql-createpublication"/> for details. Note that a subscription
      having several publications in which the same table has been published
      with different column lists is not supported. See
      <xref linkend="logical-replication-col-list-combining"/> for details of
      potential problems when altering column lists.
     </para>

     <para>
      If the optional <literal>WHERE</literal> clause is specified, rows for
      which the <replaceable class="parameter">expression</replaceable>
      evaluates to false or null will not be published. Note that parentheses
      are required around the expression. The
      <replaceable class="parameter">expression</replaceable> is evaluated with
      the role used for the replication connection.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">schema_name</replaceable></term>
    <listitem>
     <para>
      Name of an existing schema.
   

Title: ALTER PUBLICATION - Parameters and Ownership Requirements
Summary
This section details the parameters for the ALTER PUBLICATION command, including the publication name, table name (with optional ONLY, *, column list, and WHERE clause), and schema name. It also specifies ownership and privilege requirements: the publication owner must use ALTER PUBLICATION; adding a table requires owning the table; superuser privileges are needed for ADD/SET TABLES IN SCHEMA; and altering the owner requires SET ROLE and CREATE privilege on the database. Superusers have fewer restrictions and changing the ownership of a FOR ALL TABLES or FOR TABLES IN SCHEMA publications also requires the new owner to be a superuser.