Saving load exceptions (EXCEPTIONS)
COPY exceptions consist of informational messages describing why a row of data could not be parsed. The EXCEPTIONS option lets you specify a file to which COPY writes exceptions. If you omit this option, COPY saves exception files to the following path: catalog-dir
/CopyErrorLogs/
tablename
-
sourcefilename
-copy-from-exceptions
, where:
-
catalog-dir
is the directory holding the database catalog files -
table
is the name of the table being loaded into -
sourcefile
is the name of the file being loaded
Note
REJECTED DATA AS TABLE is mutually exclusive with EXCEPTIONS.The file produced by the EXCEPTIONS option indicates the line number and the reason for each exception.
If copying from STDIN, the source file name is STDIN.
You can specify rejected data and exceptions files for individual files in a data load. Separate rejected data and exception file names with commas in the COPY statement.
You must specify a filename in the path to load multiple input files. Keep in mind that long table names combined with long data file names can exceed the operating system's maximum length (typically 255 characters). To work around file names exceeding the maximum length, use a path for the exceptions file that differs from the default path; for example, /tmp/<shorter-file-name>
.
If you specify an EXCEPTIONS path:
-
For one data file, the path must be a file, and COPY stores all information in this file.
-
For multiple data files, the path must be a directory. COPY creates one file in this directory for each data file.
-
Exceptions files are not stored on the initiator node.
-
You can specify only one path per node.
If you do not specify the EXCEPTIONS path, COPY stores exception files in the default directory.