Home Explore Blog CI



postgresql

24th chunk of `doc/src/sgml/logical-replication.sgml`
040c833684bea8b53fad629d7cc06d439ac93e69ea185a940000000100000fa6
 <literal>Key</literal> section includes the key values of the local
         tuple that violated a unique constraint for
         <literal>insert_exists</literal>, <literal>update_exists</literal> or
         <literal>multiple_unique_conflicts</literal> conflicts.
        </para>
       </listitem>
       <listitem>
        <para>
         The <literal>existing local tuple</literal> section includes the local
         tuple if its origin differs from the remote tuple for
         <literal>update_origin_differs</literal> or <literal>delete_origin_differs</literal>
         conflicts, or if the key value conflicts with the remote tuple for
         <literal>insert_exists</literal>, <literal>update_exists</literal> or
         <literal>multiple_unique_conflicts</literal> conflicts.
        </para>
       </listitem>
       <listitem>
        <para>
         The <literal>remote tuple</literal> section includes the new tuple from
         the remote insert or update operation that caused the conflict. Note that
         for an update operation, the column value of the new tuple will be null
         if the value is unchanged and toasted.
        </para>
       </listitem>
       <listitem>
        <para>
         The <literal>replica identity</literal> section includes the replica
         identity key values that were used to search for the existing local
         tuple to be updated or deleted. This may include the full tuple value
         if the local relation is marked with
         <link linkend="sql-altertable-replica-identity-full"><literal>REPLICA IDENTITY FULL</literal></link>.
        </para>
       </listitem>
       <listitem>
        <para>
         <replaceable class="parameter">column_name</replaceable> is the column name.
         For <literal>existing local tuple</literal>, <literal>remote tuple</literal>,
         and <literal>replica identity full</literal> cases, column names are
         logged only if the user lacks the privilege to access all columns of
         the table. If column names are present, they appear in the same order
         as the corresponding column values.
        </para>
       </listitem>
       <listitem>
        <para>
         <replaceable class="parameter">column_value</replaceable> is the column value.
         The large column values are truncated to 64 bytes.
        </para>
       </listitem>
       <listitem>
        <para>
         Note that in case of <literal>multiple_unique_conflicts</literal> conflict,
         multiple <replaceable class="parameter">detailed_explanation</replaceable>
         and <replaceable class="parameter">detail_values</replaceable> lines
         will be generated, each detailing the conflict information associated
         with distinct unique
         constraints.
        </para>
       </listitem>
      </itemizedlist>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>

  <para>
   Logical replication operations are performed with the privileges of the role
   which owns the subscription.  Permissions failures on target tables will
   cause replication conflicts, as will enabled
   <link linkend="ddl-rowsecurity">row-level security</link> on target tables
   that the subscription owner is subject to, without regard to whether any
   policy would ordinarily reject the <command>INSERT</command>,
   <command>UPDATE</command>, <command>DELETE</command> or
   <command>TRUNCATE</command> which is being replicated.  This restriction on
   row-level security may be lifted in a future version of
   <productname>PostgreSQL</productname>.
  </para>

  <para>
   A conflict that produces an error will stop the replication; it must be
   resolved manually by the user.  Details about the conflict can be found in
   the subscriber's server log.
  </para>

  <para>
   The resolution can be done either by changing data or permissions on the subscriber so
   that it does not conflict with the incoming change or by skipping the
   transaction that conflicts

Title: Detailed Explanation of Conflict Logging and Resolution
Summary
This section elaborates on the content of the 'DETAIL' section in logical replication conflict logs, explaining the purpose of the 'Key', 'existing local tuple', 'remote tuple', and 'replica identity' sections. It notes that column names are included in logs only when the user lacks privileges to access all columns, and large column values are truncated. It also discusses the handling of `multiple_unique_conflicts`. It further explains that logical replication operates with the privileges of the subscription owner, and permission failures or row-level security policies can cause conflicts. Finally, it emphasizes that unresolved conflicts halt replication and must be manually addressed.