Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/create_publication.sgml`
cfa340163cd84ddcebd8ee3fcfd6e29d78588291491a9d4b0000000100000fa0
 level publication, all
      of its existing and future partitions are implicitly considered to be part of the
      publication, regardless of whether they are from the publication schema or not.
      So, even operations that are performed directly on a
      partition are also published via publications that its ancestors are
      part of.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="sql-createpublication-params-with">
    <term><literal>WITH ( <replaceable class="parameter">publication_parameter</replaceable> [= <replaceable class="parameter">value</replaceable>] [, ... ] )</literal></term>
    <listitem>
     <para>
      This clause specifies optional parameters for a publication.  The
      following parameters are supported:

      <variablelist>
       <varlistentry id="sql-createpublication-params-with-publish">
        <term><literal>publish</literal> (<type>string</type>)</term>
        <listitem>
         <para>
          This parameter determines which DML operations will be published by
          the new publication to the subscribers.  The value is
          comma-separated list of operations.  The allowed operations are
          <literal>insert</literal>, <literal>update</literal>,
          <literal>delete</literal>, and <literal>truncate</literal>.
          The default is to publish all actions,
          and so the default value for this option is
          <literal>'insert, update, delete, truncate'</literal>.
         </para>
         <para>
          This parameter only affects DML operations. In particular, the initial
          data synchronization (see <xref linkend="logical-replication-snapshot"/>)
          for logical replication does not take this parameter into account when
          copying existing table data.
         </para>
        </listitem>
       </varlistentry>

       <varlistentry id="sql-createpublication-params-with-publish-generated-columns">
        <term><literal>publish_generated_columns</literal> (<type>enum</type>)</term>
        <listitem>
         <para>
          Specifies whether the generated columns present in the tables
          associated with the publication should be replicated. Possible values
          are <literal>none</literal> and <literal>stored</literal>.
         </para>

         <para>
          The default is <literal>none</literal> meaning the generated
          columns present in the tables associated with publication will not be
          replicated.
         </para>

         <para>
          If set to <literal>stored</literal>, the stored generated columns
          present in the tables associated with publication will be replicated.
         </para>

         <note>
          <para>
           If the subscriber is from a release prior to 18, then initial table
           synchronization won't copy generated columns even if parameter
           <literal>publish_generated_columns</literal> is <literal>stored</literal>
           in the publisher.
          </para>
         </note>

         <para>
          See <xref linkend="logical-replication-gencols"/> for more details about
          logical replication of generated columns.
         </para>
        </listitem>
       </varlistentry>

       <varlistentry id="sql-createpublication-params-with-publish-via-partition-root">
        <term><literal>publish_via_partition_root</literal> (<type>boolean</type>)</term>
        <listitem>
         <para>
          This parameter determines whether changes in a partitioned table (or
          on its partitions) contained in the publication will be published
          using the identity and schema of the partitioned table rather than
          that of the individual partitions that are actually changed; the
          latter is the default.  Enabling this allows the changes to be
          replicated into a non-partitioned table or a partitioned table
          consisting of a different set of partitions.
         </para>

      

Title: CREATE PUBLICATION: WITH Clause Parameters (publish, publish_generated_columns, publish_via_partition_root)
Summary
This section describes the WITH clause parameters for CREATE PUBLICATION. It covers 'publish', which specifies the DML operations (insert, update, delete, truncate) to be replicated. It also explains 'publish_generated_columns', which dictates whether stored generated columns are replicated and 'publish_via_partition_root' which when enabled publishes changes in a partitioned table using the partitioned table's identity rather than individual partitions.