Home Explore Blog CI



postgresql

75th chunk of `doc/src/sgml/protocol.sgml`
2da9592062f0392c71272a22492f36f9125c3474bbeafcf60000000100000fa3
 data type name, and
    constraint name are supplied only for a limited number of error types;
    see <xref linkend="errcodes-appendix"/>.  Frontends should not assume that
    the presence of any of these fields guarantees the presence of another
    field.  Core error sources observe the interrelationships noted above, but
    user-defined functions may use these fields in other ways.  In the same
    vein, clients should not assume that these fields denote contemporary
    objects in the current database.
   </para>
  </note>

  <para>
   The client is responsible for formatting displayed information to meet its
   needs; in particular it should break long lines as needed.  Newline characters
   appearing in the error message fields should be treated as paragraph breaks,
   not line breaks.
  </para>
 </sect1>

 <sect1 id="protocol-logicalrep-message-formats">
  <title>Logical Replication Message Formats</title>

  <para>
   This section describes the detailed format of each logical replication
   message.  These messages are either returned by the replication slot SQL
   interface or are sent by a walsender.  In the case of a walsender, they are
   encapsulated inside replication protocol WAL messages as described in
   <xref linkend="protocol-replication"/>, and generally obey the same message
   flow as physical replication.
  </para>

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

      <varlistentry>
       <term>Int64 (XLogRecPtr)</term>
       <listitem>
        <para>
         The final LSN of the transaction.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int64 (TimestampTz)</term>
       <listitem>
        <para>
         Commit timestamp of the transaction. The value is in number
         of microseconds since PostgreSQL epoch (2000-01-01).
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32 (TransactionId)</term>
       <listitem>
        <para>
         Xid of the transaction.
        </para>
       </listitem>
      </varlistentry>
     </variablelist>
    </listitem>
   </varlistentry>

   <varlistentry id="protocol-logicalrep-message-formats-Message">
    <term>Message</term>
    <listitem>
     <variablelist>
      <varlistentry>
       <term>Byte1('M')</term>
       <listitem>
        <para>
         Identifies the message as a logical decoding 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>Int8</term>
       <listitem>
        <para>
         Flags; Either 0 for no flags or 1 if the logical decoding
         message is transactional.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int64 (XLogRecPtr)</term>
       <listitem>
        <para>
         The LSN of the logical decoding message.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>String</term>
       <listitem>
        <para>
         The prefix of the logical decoding message.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32</term>
       <listitem>
        <para>
         Length of the content.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte<replaceable>n</replaceable></term>
       <listitem>
        <para>
         The content of the logical decoding message.

Title: Logical Replication Message Formats
Summary
This section describes the detailed format of logical replication messages in PostgreSQL, including begin and message formats, which contain information such as transaction IDs, timestamps, and LSNs, and are used for streaming transactions and logical decoding.