Assertion failure i==j on ADD FOREIGN KEY
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.