Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8979

IGNORE does not ignore the error 1452

    XMLWordPrintable

Details

    • 10.0.25

    Description

      The manual specifies that the IGNORE keyword should ignore the error 1452 (ER_NO_REFERENCED_ROW_2 — Cannot 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`))

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.