Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
--source include/have_innodb.inc
|
|
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), ALGORITHM=COPY; |
|
# Cleanup
|
DROP TABLE t1, t2; |
10.0 802ce9672f |
CURRENT_TEST: bug.t5a
|
mysqltest: At line 7: query 'ALTER IGNORE TABLE t1 ADD FOREIGN KEY (f3) REFERENCES t1 (f1), ALGORITHM=COPY' failed: 1050: Table './test/t1' already exists
|
2019-01-05 00:14:36 7f391882c700 InnoDB: Error; possible reasons:
|
InnoDB: 1) Table rename would cause two FOREIGN KEY constraints
|
InnoDB: to have the same internal name in case-insensitive comparison.
|
InnoDB: 2) table `test`.`t1` exists in the InnoDB internal data
|
InnoDB: dictionary though MySQL is trying to rename table `test`.`#sql-5a68_3` to it.
|
InnoDB: Have you deleted the .frm file and not used DROP TABLE?
|
InnoDB: You can look for further help from
|
InnoDB: http://dev.mysql.com/doc/refman/5.6/en/innodb-troubleshooting.html
|
InnoDB: If table `test`.`t1` is a temporary table #sql..., then it can be that
|
InnoDB: there are still queries running on the table, and it will be
|
InnoDB: dropped automatically when the queries end.
|
InnoDB: You can drop the orphaned table inside InnoDB by
|
InnoDB: creating an InnoDB table with the same name in another
|
InnoDB: database and copying the .frm file to the current database.
|
InnoDB: Then MySQL thinks the table exists, and DROP TABLE will
|
InnoDB: succeed.
|
Also reproducible on MySQL 5.6.
MySQL 5.7 doesn't understand ALTER IGNORE, so the test case is not applicable.
Attachments
Issue Links
- relates to
-
MDEV-18221 Failed to execute action for entry = ... from ddl log upon normal shutdown while running ALTER .. PARTITION
-
- Open
-
On a related note, I think that the following should be fixed at the same time:
This is unnecessarily being rejected; after all, IGNORE should imply that we do not care whether the constraint holds, and could simply add it without any checking.
This message should not be issued if IGNORE was specified, and the reason should be changed to ‘needs IGNORE or foreign_key_checks=OFF’.