Handling Import Errors¶
Scenarios¶
Handle errors that occurred during data import.
Querying Error Information¶
Errors that occur when data is imported are divided into data format errors and non-data format errors.
Data format error
When creating a foreign table, specify LOG INTO error_table_name. Data format errors occurring during the data import will be written into the specified table. You can run the following SQL statement to query error details:
SELECT * FROM error_table_name;
Table 1 lists the columns of the error_table_name table.
¶ Column
Type
Description
nodeid
integer
ID of the node where an error is reported
begintime
timestamp with time zone
Time when a data format error is reported
filename
character varying
Name of the source data file where a data format error occurs
If you use GDS for importing data, the error information includes the IP address and port number of the GDS server.
rownum
bigint
Number of the row where an error occurs in a source data file
rawrecord
text
Raw record of the data format error in the source data file
detail
text
Error details
Non-data format error
A non-data format error leads to the failure of an entire data import task. You can locate and troubleshoot a non-data format error based on the error message displayed during data import.
Handling data import errors¶
Troubleshoot data import errors based on obtained error information and the description in the following table.
Error Information | Cause | Solution |
---|---|---|
missing data for column "r_reason_desc" |
|
|
extra data after last expected column | The number of columns in the source data file is greater than that in the foreign table. |
|
invalid input syntax for type numeric: "a" | The data type is incorrect. | In the source data file, change the data type of the columns to be imported. If this error information is displayed, change the data type to numeric. |
null value in column "staff_id" violates not-null constraint | The not-null constraint is violated. | In the source data file, add values to the specified columns. If this error information is displayed, add values to the staff_id column. |
duplicate key value violates unique constraint "reg_id_pk" | The unique constraint is violated. |
|
value too long for type character varying(16) | The column length exceeds the upper limit. | In the source data file, change the column length. If this error information is displayed, reduce the column length to no greater than 16 bytes (VARCHAR2). |