the server process (normally
the cluster's data directory), not the client's working directory.
</para>
<para>
Executing a command with <literal>PROGRAM</literal> might be restricted
by the operating system's access control mechanisms, such as SELinux.
</para>
<para>
<command>COPY FROM</command> will invoke any triggers and check
constraints on the destination table. However, it will not invoke rules.
</para>
<para>
For identity columns, the <command>COPY FROM</command> command will always
write the column values provided in the input data, like
the <command>INSERT</command> option <literal>OVERRIDING SYSTEM
VALUE</literal>.
</para>
<para>
<command>COPY</command> input and output is affected by
<varname>DateStyle</varname>. To ensure portability to other
<productname>PostgreSQL</productname> installations that might use
non-default <varname>DateStyle</varname> settings,
<varname>DateStyle</varname> should be set to <literal>ISO</literal> before
using <command>COPY TO</command>. It is also a good idea to avoid dumping
data with <varname>IntervalStyle</varname> set to
<literal>sql_standard</literal>, because negative interval values might be
misinterpreted by a server that has a different setting for
<varname>IntervalStyle</varname>.
</para>
<para>
Input data is interpreted according to <literal>ENCODING</literal>
option or the current client encoding, and output data is encoded
in <literal>ENCODING</literal> or the current client encoding, even
if the data does not pass through the client but is read from or
written to a file directly by the server.
</para>
<para>
The <command>COPY FROM</command> command physically inserts input rows
into the table as it progresses. If the command fails, these rows are
left in a deleted state; these rows will not be visible, but still
occupy disk space. This might amount to considerable
wasted disk space if the failure happened well into a large copy
operation. <command>VACUUM</command> should be used to recover the
wasted space.
</para>
<para>
<literal>FORCE_NULL</literal> and <literal>FORCE_NOT_NULL</literal> can be used
simultaneously on the same column. This results in converting quoted
null strings to null values and unquoted null strings to empty strings.
</para>
</refsect1>
<refsect1 id="sql-copy-file-formats" xreflabel="File Formats">
<title>File Formats</title>
<refsect2 id="sql-copy-text-format" xreflabel="Text Format">
<title>Text Format</title>
<para>
When the <literal>text</literal> format is used,
the data read or written is a text file with one line per table row.
Columns in a row are separated by the delimiter character.
The column values themselves are strings generated by the
output function, or acceptable to the input function, of each
attribute's data type. The specified null string is used in
place of columns that are null.
<command>COPY FROM</command> will raise an error if any line of the
input file contains more or fewer columns than are expected.
</para>
<para>
End of data can be represented by a line containing just
backslash-period (<literal>\.</literal>). An end-of-data marker is
not necessary when reading from a file, since the end of file
serves perfectly well; in that context this provision exists only for
backward compatibility. However, <application>psql</application>
uses <literal>\.</literal> to terminate a <literal>COPY FROM
STDIN</literal> operation (that is, reading
in-line <command>COPY</command> data in an SQL script). In that
context the rule is needed to be able to end the operation before the
end of the script.
</para>
<para>
Backslash characters (<literal>\</literal>) can be used in the
<command>COPY</command> data to quote data characters that might