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

Assertion failure i==j on ADD FOREIGN KEY

    XMLWordPrintable

    Details

      Description

      The following test case triggers a debug assertion failure during ALTER TABLE:

      --source include/have_innodb.inc
      CREATE TABLE t1(a INT PRIMARY KEY) ENGINE=InnoDB;
      CREATE TABLE t2(a INT PRIMARY KEY) ENGINE=InnoDB;
      ALTER TABLE t2 ADD FOREIGN KEY(a) REFERENCES t1;
      DROP TABLE t2, t1;
      

      10.5 f1acd9f14bd054b8d8d576c6fe567226c097132d

      mysqltest: At line 4: query 'ALTER TABLE t2 ADD FOREIGN KEY(a) REFERENCES t1' failed: 2013: Lost connection to MySQL server during query
      ...
      mariadbd: /mariadb/10.5/storage/innobase/handler/ha_innodb.cc:12306: dberr_t create_table_info_t::create_foreign_keys(): Assertion `i == j' failed.
      

      The reason appears to be that an empty column list will be passed for the REFERENCES t1. I would expect that the matching column names be looked up (in this case a) and their data type compatibility be checked before ha_innobase::create() is invoked.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              midenok Aleksey Midenkov
              Reporter:
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration