Define an External Table with Single Row Error Isolation

The following example logs errors internally in Greenplum Database and sets an error threshold of 10 errors.

  1. =# CREATE EXTERNAL TABLE ext_expenses ( name text,
  2. date date, amount float4, category text, desc1 text )
  3. LOCATION ('gpfdist://etlhost-1:8081/*',
  4. 'gpfdist://etlhost-2:8082/*')
  5. FORMAT 'TEXT' (DELIMITER '|')
  6. LOG ERRORS SEGMENT REJECT LIMIT 10
  7. ROWS;

Use the built-in SQL function gp_read_error_log('external\_table') to read the error log data. This example command displays the log errors for ext_expenses:

  1. SELECT gp_read_error_log('ext_expenses');

For information about the format of the error log, see Viewing Bad Rows in the Error Log.

The built-in SQL function gp_truncate_error_log('external\_table') deletes the error data. This example deletes the error log data created from the previous external table example :

  1. SELECT gp_truncate_error_log('ext_expenses');

Parent topic: Handling Load Errors