Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-18139 ALTER IGNORE ... ADD FOREIGN KEY causes bogus error
dict_create_foreign_constraints_low(): Tolerate the keywords IGNORE and ONLINE between the keywords ALTER and TABLE. We should really remove the hacky FOREIGN KEY constraint parser from InnoDB.
- Loading branch information
Showing
4 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # | ||
| # MDEV-18630 Conditional jump or move depends on uninitialised value | ||
| # in ib_push_warning / dict_create_foreign_constraints_low | ||
| # | ||
| CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
| ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b); | ||
| ERROR HY000: Can't create table 'test.#sql-temporary' (errno: 150) | ||
| SHOW WARNINGS; | ||
| Level Code Message | ||
| Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t2` not found in the data dictionary near 'FOREIGN KEY (a) REFERENCES t2 (b)'. | ||
| Error 1005 Can't create table 'test.#sql-temporary' (errno: 150) | ||
| DROP TABLE t1; | ||
| # | ||
| # MDEV-18139 ALTER IGNORE ... ADD FOREIGN KEY causes bogus error | ||
| # | ||
| CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f1)) ENGINE=InnoDB; | ||
| CREATE TABLE t2 (f INT, KEY(f)) ENGINE=InnoDB; | ||
| ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t2 (f); | ||
| ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1); | ||
| DROP TABLE t1, t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --source include/have_innodb.inc | ||
|
|
||
| --echo # | ||
| --echo # MDEV-18630 Conditional jump or move depends on uninitialised value | ||
| --echo # in ib_push_warning / dict_create_foreign_constraints_low | ||
| --echo # | ||
| CREATE TABLE t1 (a INT) ENGINE=InnoDB; | ||
| --replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/ | ||
| --error ER_CANT_CREATE_TABLE | ||
| ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b); | ||
| --replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/ | ||
| SHOW WARNINGS; | ||
| DROP TABLE t1; | ||
|
|
||
| --echo # | ||
| --echo # MDEV-18139 ALTER IGNORE ... ADD FOREIGN KEY causes bogus error | ||
| --echo # | ||
| CREATE TABLE t1 (f1 INT, f2 INT, f3 INT, KEY(f1)) ENGINE=InnoDB; | ||
| CREATE TABLE t2 (f INT, KEY(f)) ENGINE=InnoDB; | ||
| ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t2 (f); | ||
| ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1); | ||
| DROP TABLE t1, t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters