mirror of
https://github.com/postgres/postgres.git
synced 2025-07-21 16:02:15 +03:00
Improve documentation for COPY ... ON_ERROR ...
Discussion: https://postgr.es/m/20240126112829.d420b28859fbe84379fdb7ad%40sraoss.co.jp Author: Yugo Nagata Reviewed-by: Masahiko Sawada, David G. Johnston, Atsushi Torikoshi
This commit is contained in:
@ -90,6 +90,13 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
|
|||||||
in the <structname>pg_stat_progress_copy</structname> view. See
|
in the <structname>pg_stat_progress_copy</structname> view. See
|
||||||
<xref linkend="copy-progress-reporting"/> for details.
|
<xref linkend="copy-progress-reporting"/> for details.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
By default, <command>COPY</command> will fail if it encounters an error
|
||||||
|
during processing. For use cases where a best-effort attempt at loading
|
||||||
|
the entire file is desired, the <literal>ON_ERROR</literal> clause can
|
||||||
|
be used to specify some other behavior.
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
@ -378,17 +385,20 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
|
|||||||
<term><literal>ON_ERROR</literal></term>
|
<term><literal>ON_ERROR</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Specifies which <replaceable class="parameter">
|
Specifies how to behave when encountering an error converting a column's
|
||||||
error_action</replaceable> to perform when there is malformed data in the input.
|
input value into its data type.
|
||||||
Currently, only <literal>stop</literal> (default) and <literal>ignore</literal>
|
An <replaceable class="parameter">error_action</replaceable> value of
|
||||||
values are supported.
|
<literal>stop</literal> means fail the command, while
|
||||||
If the <literal>stop</literal> value is specified,
|
<literal>ignore</literal> means discard the input row and continue with the next one.
|
||||||
<command>COPY</command> stops operation at the first error.
|
The default is <literal>stop</literal>.
|
||||||
If the <literal>ignore</literal> value is specified,
|
</para>
|
||||||
<command>COPY</command> skips malformed data and continues copying data.
|
<para>
|
||||||
The option is allowed only in <command>COPY FROM</command>.
|
The <literal>ignore</literal> option is applicable only for <command>COPY FROM</command>
|
||||||
Only <literal>stop</literal> value is allowed when
|
when the <literal>FORMAT</literal> is <literal>text</literal> or <literal>csv</literal>.
|
||||||
using <literal>binary</literal> format.
|
</para>
|
||||||
|
<para>
|
||||||
|
A <literal>NOTICE</literal> message containing the ignored row count is emitted at the end
|
||||||
|
of the <command>COPY FROM</command> if at least one row was discarded.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -576,15 +586,13 @@ COPY <replaceable class="parameter">count</replaceable>
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<command>COPY</command> stops operation at the first error when
|
The <command>COPY FROM</command> command physically inserts input rows
|
||||||
<literal>ON_ERROR</literal> is not specified. This
|
into the table as it progresses. If the command fails, these rows are
|
||||||
should not lead to problems in the event of a <command>COPY
|
left in a deleted state; these rows will not be visible, but still
|
||||||
TO</command>, but the target table will already have received
|
occupy disk space. This might amount to considerable
|
||||||
earlier rows in a <command>COPY FROM</command>. These rows will not
|
wasted disk space if the failure happened well into a large copy
|
||||||
be visible or accessible, but they still occupy disk space. This might
|
operation. <command>VACUUM</command> should be used to recover the
|
||||||
amount to a considerable amount of wasted disk space if the failure
|
wasted space.
|
||||||
happened well into a large copy operation. You might wish to invoke
|
|
||||||
<command>VACUUM</command> to recover the wasted space.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
Reference in New Issue
Block a user