Home Explore Blog CI



postgresql

4th chunk of `doc/src/sgml/ref/copy.sgml`
d884f65c6ed88dbb587f3e4c3a4a9dd58cd078ef5336a4630000000100000fa2
 <literal>binary</literal>.
      The default is <literal>text</literal>.
      See <xref linkend="sql-copy-file-formats"/> below for details.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>FREEZE</literal></term>
    <listitem>
     <para>
      Requests copying the data with rows already frozen, just as they
      would be after running the <command>VACUUM FREEZE</command> command.
      This is intended as a performance option for initial data loading.
      Rows will be frozen only if the table being loaded has been created
      or truncated in the current subtransaction, there are no cursors
      open and there are no older snapshots held by this transaction.  It is
      currently not possible to perform a <command>COPY FREEZE</command> on
      a partitioned table or foreign table.
      This option is only allowed in <command>COPY FROM</command>.
     </para>
     <para>
      Note that all other sessions will immediately be able to see the data
      once it has been successfully loaded. This violates the normal rules
      of MVCC visibility and users should be aware of the
      potential problems this might cause.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DELIMITER</literal></term>
    <listitem>
     <para>
      Specifies the character that separates columns within each row
      (line) of the file.  The default is a tab character in text format,
      a comma in <literal>CSV</literal> format.
      This must be a single one-byte character.
      This option is not allowed when using <literal>binary</literal> format.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>NULL</literal></term>
    <listitem>
     <para>
      Specifies the string that represents a null value. The default is
      <literal>\N</literal> (backslash-N) in text format, and an unquoted empty
      string in <literal>CSV</literal> format. You might prefer an
      empty string even in text format for cases where you don't want to
      distinguish nulls from empty strings.
      This option is not allowed when using <literal>binary</literal> format.
     </para>

     <note>
      <para>
       When using <command>COPY FROM</command>, any data item that matches
       this string will be stored as a null value, so you should make
       sure that you use the same string as you used with
       <command>COPY TO</command>.
      </para>
     </note>

    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DEFAULT</literal></term>
    <listitem>
     <para>
      Specifies the string that represents a default value. Each time the string
      is found in the input file, the default value of the corresponding column
      will be used.
      This option is allowed only in <command>COPY FROM</command>, and only when
      not using <literal>binary</literal> format.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>HEADER</literal></term>
    <listitem>
     <para>
      Specifies that the file contains a header line with the names of each
      column in the file.  On output, the first line contains the column
      names from the table.  On input, the first line is discarded when this
      option is set to <literal>true</literal> (or equivalent Boolean value).
      If this option is set to <literal>MATCH</literal>, the number and names
      of the columns in the header line must match the actual column names of
      the table, in order;  otherwise an error is raised.
      This option is not allowed when using <literal>binary</literal> format.
      The <literal>MATCH</literal> option is only valid for <command>COPY
      FROM</command> commands.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>QUOTE</literal></term>
    <listitem>
     <para>
      Specifies the quoting character to be used when a data value is quoted.
      The default

Title: COPY Command Parameters: FORMAT, FREEZE, DELIMITER, NULL, DEFAULT, and HEADER
Summary
This section details more parameters for the COPY command, including the data format (FORMAT), freezing rows during initial data loading (FREEZE), specifying the column delimiter (DELIMITER), defining the string representing NULL values (NULL), using default values (DEFAULT), and handling header lines in the file (HEADER).