Bug #42814 No error message displayed while loading similar data from a text file
Submitted: 13 Feb 2009 5:02 Modified: 17 Feb 2009 5:08
Reporter: Sandeep S Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.1.31 OS:Linux (Red Hat Enterprise Linux 4 )
Assigned to: CPU Architecture:Any
Tags: load data error, LOAD DATA INFILE

[13 Feb 2009 5:02] Sandeep S
Description:
I have two text files 'A.txt' and 'B.txt' say and a row having same data(primary key is enabled too). Now when i use load data .. infile command' there's no error thrown whereas if i use 'insert into<tablename>' i get 
ERROR 1062 (23000): Duplicate entry '2008-12-09 22:27:03' for key 'PRIMARY'

What to do to get similar kind of error as the requirement is to catch and throw the error when i load similar data from text files! 

Note: primary key is perfectly unique! No issues with it at all! 

How to repeat:
mysql> load data local infile "/home/guest/project/A.txt' into table abcde fields terminated by ',' ignore 1 lines;

Query OK, 6 rows affected  ... 

mysql> load data local infile "/home/guest/project/B.txt' into table abcde fields terminated by ',' ignore 1 lines;

Query OK, 6 rows affected  ... 

Query OK, 6 rows affected  ... 
 .. Skpped: 1 

whereas if i use insert into abcde ... 

ERROR 1062 (23000): Duplicate entry '2008-12-09 22:27:03' for key 'PRIMARY'

How to catch the skipped error and throw it to the user?
[14 Feb 2009 12:49] Sveta Smirnova
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Thank you for your interest in MySQL.

Please read at http://dev.mysql.com/doc/refman/5.1/en/load-data.html:

With LOCAL, the default behavior is the same as if IGNORE is specified; this is because the server has no way to stop transmission of the file in the middle of the operation. IGNORE is explained further later in this section.
[17 Feb 2009 5:08] Sandeep S
I have two text files 'A.txt' and 'B.txt' say and a row having same data(primary key is
enabled too). Now when one uses load data .. infile command' there's no error thrown whereas
if one uses 'insert into<tablename>' you get 
ERROR 1062 (23000): Duplicate entry '2008-12-09 22:27:03' for key 'PRIMARY'

Note: primary key is perfectly unique! No issues with it at all! 

mysql> load data local infile "/home/guest/project/A.txt' into table abcde fields
terminated by ',' ignore 1 lines;

Query OK, 6 rows affected  ... 

mysql> load data local infile "/home/guest/project/B.txt' into table abcde fields
terminated by ',' ignore 1 lines;

Query OK, 6 rows affected  ... 

Query OK, 6 rows affected  ... 
 .. Skpped: 1 

No error thrown!