Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.4.31, 10.5.22, 10.6.15, 10.10.6, 10.11.5, 11.0.3, 11.1.2, 11.2.1, 11.3.0
-
None
Description
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.
Attachments
Issue Links
- is caused by
-
MDEV-31086 MODIFY COLUMN can break FK constraints, and lead to unrestorable dumps
- Closed