Home Explore Blog CI



postgresql

16th chunk of `doc/src/sgml/ref/copy.sgml`
2038179dedb7aed065de3a7cf41c998c9522c3b5c0f5b869000000010000084c
 ALGERIA
ZM      ZAMBIA
ZW      ZIMBABWE
</programlisting>
   Note that the white space on each line is actually a tab character.
  </para>

  <para>
   The following is the same data, output in binary format.
   The data is shown after filtering through the
   Unix utility <command>od -c</command>. The table has three columns;
   the first has type <type>char(2)</type>, the second has type <type>text</type>,
   and the third has type <type>integer</type>. All the rows have a null value
   in the third column.
<programlisting>
0000000   P   G   C   O   P   Y  \n 377  \r  \n  \0  \0  \0  \0  \0  \0
0000020  \0  \0  \0  \0 003  \0  \0  \0 002   A   F  \0  \0  \0 013   A
0000040   F   G   H   A   N   I   S   T   A   N 377 377 377 377  \0 003
0000060  \0  \0  \0 002   A   L  \0  \0  \0 007   A   L   B   A   N   I
0000100   A 377 377 377 377  \0 003  \0  \0  \0 002   D   Z  \0  \0  \0
0000120 007   A   L   G   E   R   I   A 377 377 377 377  \0 003  \0  \0
0000140  \0 002   Z   M  \0  \0  \0 006   Z   A   M   B   I   A 377 377
0000160 377 377  \0 003  \0  \0  \0 002   Z   W  \0  \0  \0  \b   Z   I
0000200   M   B   A   B   W   E 377 377 377 377 377 377
</programlisting></para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   There is no <command>COPY</command> statement in the SQL standard.
  </para>

  <para>
   The following syntax was used before <productname>PostgreSQL</productname>
   version 9.0 and is still supported:

<synopsis>
COPY <replaceable class="parameter">table_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ]
    FROM { '<replaceable class="parameter">filename</replaceable>' | STDIN }
    [ [ WITH ]
          [ BINARY ]
          [ DELIMITER [ AS ] '<replaceable class="parameter">delimiter_character</replaceable>' ]
          [ NULL [ AS ] '<replaceable class="parameter">null_string</replaceable>' ]
          [ CSV [ HEADER ]
                [ QUOTE [ AS ] '<replaceable class="parameter">quote_character</replaceable>' ]
                [ ESCAPE [ AS ] '<replaceable class="parameter">escape_character</replaceable>'

Title: COPY Examples (Continued) and Compatibility
Summary
This section continues to provide examples of the COPY command, specifically showcasing data output in binary format as interpreted by the Unix utility 'od -c'. The example demonstrates data for a table with three columns (char(2), text, and integer) where all rows have a null value in the third column. The section then addresses the compatibility of the COPY command, noting its absence in the SQL standard. It also presents the older syntax of the COPY command, which was used before PostgreSQL version 9.0 and is still supported.