List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:March 14 1999 2:04pm
Subject:LOAD DATA INFILE does not complain about duplicate records
View as plain text  
>>>>> "Neal" == Neal Holtz <nholtz@stripped> writes:

Neal> MySQL Version 3.22.19b  (and 3.22.15-gamma):
Neal> The LOAD DATA INFILE query does not seem to complain about
Neal> duplicate records, as my reading of Section 7.15 says it should
Neal> (there are REPLACE and IGNORE options if you want that behaviour).
Neal> Currently it just silently ignores duplicates.  I create and load
Neal> a table with:

Neal> ----------------
Neal> DROP TABLE IF EXISTS dups;

Neal> CREATE TABLE dups (
Neal>   uid           INT PRIMARY KEY,
Neal>   name          CHAR(10)
Neal> );

Neal> LOAD DATA LOCAL INFILE 'test-data.txt'
Neal>      INTO TABLE dups
Neal>      FIELDS TERMINATED BY ',' 
Neal>      OPTIONALLY ENCLOSED BY '"'
Neal>         ;
Neal> ----------------

Neal> And the data file 'test-data.txt' is:

Neal> ----------------
Neal> 1,one
Neal> 2,two
Neal> 1,one again
Neal> 3,three
Neal> ----------------

Neal> I think an error message should be produced by the third record,
Neal> as the primary key is a duplicate of that in record 1.  Currently,
Neal> it is silently dropped.

Neal> cheers
Neal> neal

Hi!

The problem is that when you are using LOAD DATA LOCAL INFILE, then
                                                 ^^^^^
the DEFAULT behaveour is to ignore all duplicates.  The problem is
that the server/protocol for dumping files from the client to the
server doesn't include any possibility for the server to stop the
transmission in the middle.

Regards,
Monty
Thread
LOAD DATA INFILE does not complain about duplicate recordsNeal Holtz13 Mar
  • LOAD DATA INFILE does not complain about duplicate recordsMichael Widenius15 Mar