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

Foreign key regression from 10.11.9 to 10.11.10 (and 11.4.4)

    XMLWordPrintable

Details

    Description

      After upgrading to v10.11.10 creation of a foreign key failed with no information in engine innodb status. The same keys are allowed in 10.11.9 and below.

      reproducer SQL:

      CREATE TABLE `a` (
        `a_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `a_p_id` int(10) unsigned DEFAULT NULL,
        PRIMARY KEY (`a_id`),
        FOREIGN KEY (`a_p_id`) REFERENCES `a` (`a_id`)
      ) ENGINE=InnoDBa
       
       
      CREATE TABLE `b` (
        `b_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `b_p_id` int(10) unsigned DEFAULT NULL,
        PRIMARY KEY (`b_id`),
        FOREIGN KEY (`b_p_id`) REFERENCES `b` (`b_id`)
      ) ENGINE=InnoDB
       
       
      CREATE TABLE `b_a` (
        `b_id` int(10) unsigned NOT NULL,
        `a_p_id` int(10) unsigned NOT NULL,
        `a_id` int(10) unsigned DEFAULT NULL,
        PRIMARY KEY (`b_id`,`a_p_id`),
        FOREIGN KEY (`b_id`) REFERENCES `b` (`b_id`) ON DELETE CASCADE ON UPDATE CASCADE,
        FOREIGN KEY (`a_p_id`, `a_id`) REFERENCES `a` (`a_p_id`, `a_id`) ON UPDATE CASCADE
      ) ENGINE=InnoDB
      

      Changing the table b_a latest foreign key to "on delete cascade" does allow the table to be created, but that is not what I want to archieve.

      Attachments

        Activity

          People

            thiru Thirunarayanan Balathandayuthapani
            dicode Tim Westervoorde
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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