Comments - IGNORE

8 years, 6 months ago Chongnin Liao
This comment has the status of 'removed' and can only be seen by you.

INSERT IGNORE refuses to ignore ERROR 1452, as is described in http://stackoverflow.com/questions/6849393/mysqls-insert-ignore-into-foreign-keys. To regenerate the error:

CREATE TABLE parent (id INT AUTO_INCREMENT NOT NULL , PRIMARY KEY (id) ) ENGINE=INNODB; CREATE TABLE child (id INT AUTO_INCREMENT , parent_id INT , INDEX par_ind (parent_id) , PRIMARY KEY (id) , FOREIGN KEY (parent_id) REFERENCES parent(id) ) ENGINE=INNODB; INSERT INTO parent VALUES (1) (2); INSERT IGNORE INTO child VALUES (NULL, 3);

ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`financedb`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))

Server version: 10.0.21-MariaDB-log MariaDB Server

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.