List:General Discussion« Previous MessageNext Message »
From:Claudio Nanni Date:September 23 2009 7:53am
Subject:Re: Data import problem with duplicate datasets
View as plain text  
A very first thought I got is disable the constraint before import and
re-enable after that.
One way could be to set the foreign key checks to false or alter the
constraint and remove the 'cascade delete' part.
It's just a quick brain storm, please verify the goodness of it, I still
need to get my coffee this morning!


2009/9/23 <spikerlion@stripped>

> Hello,
> we have two tables associated with a foreign key constraint.
> Table A with the primary key and table B with an "on delete cascade"
> constraint.
> We want to delete datasets in Table B if the related dataset in Table A is
> deleted - that works.
> Now the Problem:
> There is a weekly import defined on table A using a "load data infile
> <FILE> replace into table A" command.
> The problem is the implicit delete/insert from the replace keyword.
> Therefore the sets in Table B are deleted.
> We are using replace because some datasets have to be modified in some
> columns in table A.
> Is there a possibility to avoid the delete in Table B by importing data in
> Table A?
> Regards,
> Spiker
> --
> Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
> für nur 19,99 Euro/mtl.!*
> --
> MySQL General Mailing List
> For list archives:
> To unsubscribe:


Data import problem with duplicate datasetsspikerlion23 Sep
  • Re: Data import problem with duplicate datasetsClaudio Nanni23 Sep