Running COPY in Single Row Error Isolation Mode
By default, COPY
stops an operation at the first error: if the data contains an error, the operation fails and no data loads. If you run COPY FROM
in single row error isolation mode, Greenplum skips rows that contain format errors and loads properly formatted rows. Single row error isolation mode applies only to rows in the input file that contain format errors. If the data contains a constraint error such as violation of a NOT NULL
, CHECK
, or UNIQUE
constraint, the operation fails and no data loads.
Specifying SEGMENT REJECT LIMIT
runs the COPY
operation in single row error isolation mode. Specify the acceptable number of error rows on each segment, after which the entire COPY FROM
operation fails and no rows load. The error row count is for each Greenplum Database segment, not for the entire load operation.
If the COPY
operation does not reach the error limit, Greenplum loads all correctly-formatted rows and discards the error rows. Use the LOG ERRORS
clause to capture data formatting errors internally in Greenplum Database. For example:
=> COPY country FROM '/data/gpdb/country_data'
WITH DELIMITER '|' LOG ERRORS
SEGMENT REJECT LIMIT 10 ROWS;
See Viewing Bad Rows in the Error Log for information about investigating error rows.
Parent topic: Loading and Unloading Data