|
InnoDB fails to find the foreign key index for the foreign key relation
in the table while iteration the foreign key constraints.
This is caused by commit 5f09b53bdb4e973e7c7ec2c53a24c98321223f98 (MDEV-31086).
Test case to repeat the issue:
--source include/have_innodb.inc
|
SET FOREIGN_KEY_CHECKS=0;
|
CREATE TABLE t1 (f1 INT NOT NULL, INDEX(f1)) ENGINE=InnoDB;
|
CREATE TABLE t2(f1 INT NOT NULL, f2 VARCHAR(100) DEFAULT NULL,
|
INDEX idx(f1, f2),
|
FOREIGN KEY(f1) REFERENCES t1(f1))ENGINE=INNODB;
|
ALTER TABLE t2 DROP INDEX idx;
|
ALTER TABLE t2 MODIFY f2 VARCHAR(1023);
|
DROP TABLE t2, t1;
|
Fix:
===
In check_col_is_in_fk_indexes(), while iterating through
the foreign key relationship, InnoDB should consider that
foreign key relation may not have foreign index when
foreign key check is disabled.
|