Home Explore Blog CI



postgresql

57th chunk of `doc/src/sgml/protocol.sgml`
848e372d43806fe3f8dfed946fef79e9c767e771136d3a810000000100000fa0
 </varlistentry>
     </variablelist>
    </listitem>
   </varlistentry>

   <varlistentry id="protocol-message-formats-CommandComplete">
    <term>CommandComplete (B)</term>
    <listitem>
     <variablelist>
      <varlistentry>
       <term>Byte1('C')</term>
       <listitem>
        <para>
         Identifies the message as a command-completed response.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32</term>
       <listitem>
        <para>
         Length of message contents in bytes, including self.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>String</term>
       <listitem>
       <para>
        The command tag.  This is usually a single
        word that identifies which SQL command was completed.
       </para>

       <para>
        For an <command>INSERT</command> command, the tag is
        <literal>INSERT <replaceable>oid</replaceable>
        <replaceable>rows</replaceable></literal>, where
        <replaceable>rows</replaceable> is the number of rows
        inserted. <replaceable>oid</replaceable> used to be the object ID
        of the inserted row if <replaceable>rows</replaceable> was 1
        and the target table had OIDs, but OIDs system columns are
        not supported anymore; therefore <replaceable>oid</replaceable>
        is always 0.
       </para>

       <para>
        For a <command>DELETE</command> command, the tag is
        <literal>DELETE <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows deleted.
       </para>

       <para>
        For an <command>UPDATE</command> command, the tag is
        <literal>UPDATE <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows updated.
       </para>

       <para>
        For a <command>MERGE</command> command, the tag is
        <literal>MERGE <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows inserted,
        updated, or deleted.
       </para>

       <para>
        For a <command>SELECT</command> or <command>CREATE TABLE AS</command>
        command, the tag is <literal>SELECT <replaceable>rows</replaceable></literal>
        where <replaceable>rows</replaceable> is the number of rows retrieved.
       </para>

       <para>
        For a <command>MOVE</command> command, the tag is
        <literal>MOVE <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows the
        cursor's position has been changed by.
       </para>

       <para>
        For a <command>FETCH</command> command, the tag is
        <literal>FETCH <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows that
        have been retrieved from the cursor.
       </para>

       <para>
        For a <command>COPY</command> command, the tag is
        <literal>COPY <replaceable>rows</replaceable></literal> where
        <replaceable>rows</replaceable> is the number of rows copied.
        (Note: the row count appears only in
        <productname>PostgreSQL</productname> 8.2 and later.)
       </para>
       </listitem>
      </varlistentry>
     </variablelist>
    </listitem>
   </varlistentry>

   <varlistentry id="protocol-message-formats-CopyData">
    <term>CopyData (F &amp; B)</term>
    <listitem>
     <variablelist>
      <varlistentry>
       <term>Byte1('d')</term>
       <listitem>
        <para>
         Identifies the message as <command>COPY</command> data.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Int32</term>
       <listitem>
        <para>
         Length of message contents in bytes, including self.
        </para>
       </listitem>
      </varlistentry>

      <varlistentry>
       <term>Byte<replaceable>n</replaceable></term>
       <listitem>

Title: Protocol Message Formats for CommandComplete and CopyData
Summary
This section describes the message formats for CommandComplete and CopyData messages in a protocol, including the structure and content of each message type, such as command tags, row counts, and data identification, with specific examples for various SQL commands like INSERT, DELETE, UPDATE, and COPY.