[MDEV-8979] IGNORE does not ignore the error 1452 Created: 2015-10-21  Updated: 2016-04-20  Resolved: 2016-04-20

Status: Closed
Project: MariaDB Server
Component/s: Data Manipulation - Update
Affects Version/s: 5.5, 10.0, 10.1
Fix Version/s: 5.5.49, 10.0.25, 10.1.14

Type: Bug Priority: Major
Reporter: Sergei Golubchik Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: upstream, upstream-fixed

Issue Links:
PartOf
is part of MDEV-9939 5.5.49 merge Closed
Sprint: 10.0.25

 Description   

The manual specifies that the IGNORE keyword should ignore the error 1452 (ER_NO_REFERENCED_ROW_2Cannot add or update a child row: a foreign key constraint fails (%s)). But it does not:

--source include/have_innodb.inc
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);

Result:

mysqltest: At line 13: query 'INSERT IGNORE INTO child VALUES (NULL, 3)' failed: 1452: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))


Generated at Thu Feb 08 07:31:13 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.