in the pg_stat_progress_copy view. See
for details.
+
+ By default, COPY 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 ON_ERROR clause can
+ be used to specify some other behavior.
+
ON_ERROR
- Specifies which
- error_action to perform when there is malformed data in the input.
- Currently, only stop (default) and ignore
- values are supported.
- If the stop value is specified,
- COPY stops operation at the first error.
- If the ignore value is specified,
- COPY skips malformed data and continues copying data.
- The option is allowed only in COPY FROM.
- Only stop value is allowed when
- using binary format.
+ Specifies how to behave when encountering an error converting a column's
+ input value into its data type.
+ An error_action value of
+ stop means fail the command, while
+ ignore means discard the input row and continue with the next one.
+ The default is stop.
+
+ The ignore option is applicable only for COPY FROM
+ when the FORMAT is text or csv.
+
+ A NOTICE message containing the ignored row count is emitted at the end
+ of the COPY FROM if at least one row was discarded.
- COPY stops operation at the first error when
- ON_ERROR is not specified. This
- should not lead to problems in the event of a COPY
- TO, but the target table will already have received
- earlier rows in a COPY FROM. These rows will not
- be visible or accessible, but they still occupy disk space. This might
- amount to a considerable amount of wasted disk space if the failure
- happened well into a large copy operation. You might wish to invoke
- VACUUM to recover the wasted space.
+ The COPY FROM 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. VACUUM should be used to recover the
+ wasted space.