maria-discuss team mailing list archive
-
maria-discuss team
-
Mailing list archive
-
Message #03003
New Question: INSERT IGNORE refuses to ignore foreign key constraints. Bug maybe?
Hello,
A new question has been asked in "MariaDB Documentation" by stillsmil. Please answer it at http://mariadb.com/kb/en/insert-ignore-refuses-to-ignore-foreign-key-constraints-bug-maybe/ as the person asking the question may not be subscribed to the mailing list.
--------------------------------
Is this a bug?
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
--------------------------------
To view or answer this question please visit: http://mariadb.com/kb/en/insert-ignore-refuses-to-ignore-foreign-key-constraints-bug-maybe/