Home Explore Blog CI



postgresql

79th chunk of `doc/src/sgml/protocol.sgml`
80311e4771a4e3e4f28e102971644d0319e2b4abb225c5160000000100000fa0
 <term>Int32 (Oid)</term>
       <listitem>
        <para>
         OID of the relation corresponding to the ID in the relation
         message.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte1('K')</term>
       <listitem>
        <para>
         Identifies the following TupleData submessage as a key.
         This field is optional and is only present if
         the update changed data in any of the column(s) that are
         part of the REPLICA IDENTITY index.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte1('O')</term>
       <listitem>
        <para>
         Identifies the following TupleData submessage as an old tuple.
         This field is optional and is only present if table in which
         the update happened has REPLICA IDENTITY set to FULL.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>TupleData</term>
       <listitem>
        <para>
         TupleData message part representing the contents of the old tuple
         or primary key. Only present if the previous 'O' or 'K' part
         is present.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte1('N')</term>
       <listitem>
        <para>
         Identifies the following TupleData message as a new tuple.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>TupleData</term>
       <listitem>
        <para>
         TupleData message part representing the contents of a new tuple.
        </para>
       </listitem>
      </varlistentry>
     </variablelist>

     <para>
      The Update message may contain either a 'K' message part or an 'O' message part
      or neither of them, but never both of them.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="protocol-logicalrep-message-formats-Delete">
    <term>Delete</term>
    <listitem>
     <variablelist>
      <varlistentry>
       <term>Byte1('D')</term>
       <listitem>
        <para>
         Identifies the message as a delete message.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32 (TransactionId)</term>
       <listitem>
        <para>
         Xid of the transaction (only present for streamed transactions).
         This field is available since protocol version 2.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32 (Oid)</term>
       <listitem>
        <para>
         OID of the relation corresponding to the ID in the relation
         message.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte1('K')</term>
       <listitem>
        <para>
         Identifies the following TupleData submessage as a key.
         This field is present if the table in which the delete has
         happened uses an index as REPLICA IDENTITY.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte1('O')</term>
       <listitem>
        <para>
         Identifies the following TupleData message as an old tuple.
         This field is present if the table in which the delete
         happened has REPLICA IDENTITY set to FULL.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>TupleData</term>
       <listitem>
        <para>
         TupleData message part representing the contents of the old tuple
         or primary key, depending on the previous field.
        </para>
       </listitem>
      </varlistentry>
     </variablelist>

     <para>
      The Delete message may contain either a 'K' message part or an 'O' message part,
      but never both of them.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry id="protocol-logicalrep-message-formats-Truncate">
    <term>Truncate</term>
    <listitem>
     <variablelist>
      <varlistentry>
 

Title: Logical Replication Message Formats for Update, Delete, and Truncate
Summary
This section describes the message formats for Update, Delete, and Truncate operations in logical replication, including the identification of the message type, transaction ID, relation OID, and tuple data, as well as optional fields for key and old tuple data, used for streaming transactions and logical decoding in PostgreSQL, with specific rules for the presence of 'K' and 'O' message parts.