List:General Discussion« Previous MessageNext Message »
From:Neal Holtz Date:March 13 1999 12:06pm
Subject:LOAD DATA INFILE does not complain about duplicate records
View as plain text  
MySQL Version 3.22.19b  (and 3.22.15-gamma):

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

----------------
DROP TABLE IF EXISTS dups;

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

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

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

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

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

cheers
neal

-- 
Neal Holtz                             http://www.docuweb.ca/~nholtz
Dept. of Civil and Environmental Engineering,   Carleton University,   
Ottawa, Ontario, Canada K1S 5B6.                   nholtz@stripped

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