Bug #91712 | Adding FOREIGN KEY failed message is incorrect | ||
---|---|---|---|
Submitted: | 19 Jul 2018 8:00 | Modified: | 10 Apr 2019 22:07 |
Reporter: | Tsubasa Tanaka (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 5.7.22, 8.0.11 | OS: | CentOS (7.4) |
Assigned to: | CPU Architecture: | x86 |
[19 Jul 2018 8:00]
Tsubasa Tanaka
[19 Jul 2018 8:10]
MySQL Verification Team
Hello Tanaka-San, Thank you for the report! Thanks, Umesh
[7 Apr 2019 14:42]
Dmitry Lenev
Posted by developer: Hello! Thank you for your report!!! This issue was solved in MySQL Server release 8.0.14 by the following patch: ===== Author: Dmitry Lenev <dmitry.lenev@oracle.com> Date: Tue Sep 11 14:13:15 2018 +0300 Fifth and final part of fix for bug#25722927 "NEWDD FK: ALTER TABLE CHANGE COLUMN TYPE SHOULD CHECK FK CONSTRAINT". After we have started to store information about foreign keys in the Transactional Data Dictionary it became possible to move checks of foreign key definition validity from the storage engine to SQL-layer and thus reduce code duplication and simplify SE implementation. Moved check that types of referencing and referenced columns in a foreign key are compatible to SQL-layer. ... Added new, more specific error code and message which are used in cases when foreign key can't be created due to column types mismatch. ... === The new error message which above test case emits now is: ERROR 3780 (HY000): Referencing column 'num' and referenced column 'num' in foreign key constraint 't2_ibfk_1' are incompatible. I am moving this bug report to Documenting state, since I think that it might make sense to update the Release Notes for version 8.0.14 ,to not only mention that the check for column compatibility was moved to SQL layer, but also that as result we now produce better error message in case when columns are not compatible.
[10 Apr 2019 22:07]
Paul DuBois
Posted by developer: Fixed in 8.0.14. A check that ensures compatibility of referencing and referenced column types in a foreign key definition was moved from the storage engine layer to the SQL layer. In addition, a better error message is produced when columns are not compatible.