Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/ref/copy.sgml`
083a973a046e1a843e4d61b05a83dfcd4f91fb0a25d2e8320000000100000c31
   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>' ]
                [ FORCE NOT NULL <replaceable class="parameter">column_name</replaceable> [, ...] ] ] ]

COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable class="parameter">column_name</replaceable> [, ...] ) ] | ( <replaceable class="parameter">query</replaceable> ) }
    TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT }
    [ [ 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>' ]
                [ FORCE QUOTE { <replaceable class="parameter">column_name</replaceable> [, ...] | * } ] ] ]
</synopsis>

   Note that in this syntax, <literal>BINARY</literal> and <literal>CSV</literal> are
   treated as independent keywords, not as arguments of a <literal>FORMAT</literal>
   option.
  </para>

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

<synopsis>
COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable>
    FROM { '<replaceable class="parameter">filename</replaceable>' | STDIN }
    [ [USING] DELIMITERS '<replaceable class="parameter">delimiter_character</replaceable>' ]
    [ WITH NULL AS '<replaceable class="parameter">null_string</replaceable>' ]

COPY [ BINARY ] <replaceable class="parameter">table_name</replaceable>
    TO { '<replaceable class="parameter">filename</replaceable>' | STDOUT }
    [ [USING] DELIMITERS '<replaceable class="parameter">delimiter_character</replaceable>' ]
    [ WITH NULL AS '<replaceable class="parameter">null_string</replaceable>' ]
</synopsis></para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="copy-progress-reporting"/></member>
  </simplelist>
 </refsect1>
</refentry>

Title: COPY Command Compatibility and Older Syntax Versions
Summary
This section discusses the compatibility of the COPY command, noting its absence from the SQL standard. It outlines the syntax supported before PostgreSQL version 9.0, highlighting the use of BINARY and CSV as independent keywords rather than arguments of a FORMAT option. Furthermore, it presents the syntax used before PostgreSQL version 7.3, which is also still supported. Finally, it provides a 'See Also' section referencing 'copy-progress-reporting'.