List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:August 3 1999 12:16am
Subject:load data LOCAL doesn't respect unique keys
View as plain text  
>>>>> "Peter" == Peter Ludemann <ludemann@stripped> writes:

>> Description:
Peter> "load data infile ..." behaves as documented, giving an error for
Peter> duplicate keys.  If "local" is also specified, behaviour is the same
Peter> as "load data infile ... ignore", which is incorrect.

Peter> Attached (in "How-to-repeat") is the output from mysql.  As you can
Peter> see, "load data infile" generates an ERROR 1062 but "load data local
Peter> infile" generates no error.

Peter> The documentation states (section 7.15):

Peter>     The REPLACE and IGNORE keywords control handling of input records that
Peter>     duplicate existing records on unique key values. If you specify
Peter>     REPLACE, new rows replace existing rows that have the same unique key 
Peter>     value. If you specify IGNORE, input rows that duplicate an existing
Peter>     row on a unique key value are skipped. If you don't specify either
Peter>     option, an error occurs when a duplicate key value is found, and the
Peter>     rest of the text file is ignored.



I agree.  Logically you are 100 % correct.  The problem is that the
when you use LOCAL, the client pushes all data to the server and the
server cant tell the client that something went wrong in the middle.
Until we have been able to fix this (which would require some kind of
protocol change) the LOCAL keyword will also implicitly mean IGNORE.

I shall document this!

load data LOCAL doesn't respect unique keysPeter Ludemann3 Aug
  • load data LOCAL doesn't respect unique keysMichael Widenius3 Aug
Re: load data LOCAL doesn't respect unique keysPeter Ludemann3 Aug