Bug #78754 | FK definitions missing from SHOW CREATE TABLE in "innodb_read_only" mode | ||
---|---|---|---|
Submitted: | 8 Oct 2015 11:27 | Modified: | 4 Sep 2019 21:06 |
Reporter: | Szymon Komendera | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
Version: | 5.6, 5.7, 5.6.27 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[8 Oct 2015 11:27]
Szymon Komendera
[8 Oct 2015 12:03]
MySQL Verification Team
Hello Szymon Komendera, Thank you for the report and test case. Thanks, Umesh
[3 Sep 2019 16:38]
Dmitry Lenev
Posted by developer: Hello! This issue has been fixed in MySQL 8.0.19 by the same fix as for bug#25583288 "DO NOT USE HA_INNOBASE::GET_FOREIGN_KEY_CREATE_INFO() FOR SHOW CREATE TABLE FK". commit 047c7c35f58d5fa4149b32c12fa5f12892228349 Author: Dmitry Lenev <dmitry.lenev@oracle.com> Date: Thu Aug 22 10:37:42 2019 +0300 Bug#25583288 "DO NOT USE HA_INNOBASE::GET_FOREIGN_KEY_CREATE_INFO() FOR SHOW CREATE TABLE FK". In MySQL 8.0 all information about foreign keys is available from the new SQL-layer data-dictionary. However, SHOW CREATE TABLE implementation still relied on storage engines to provide CREATE TABLE clauses describing foreign key constraints. This resulted in duplicate code in SEs and in other issues, like: - Non-uniform behavior of SHOW CREATE TABLE for foreign keys in InnoDB and NDB SEs (different spacing, different approach to defaults output). - Bug#21966795 "FK DEFINITIONS MISSING FROM SHOW CREATE TABLE IN 'INNODB_READ_ONLY' MODE". In which the problem occurred due to fact that InnoDB code responsible for printing foreign key clauses for SHOW CREATE TABLE used temporary file which was not available in --innodb-read-only mode. - Bug#30110545 "FK TABLE NAME CASING IS OMITTED ON MYSQL 8 LOWER_CASE_TABLE_NAMES=2" In which name of parent table in a foreign key has been shown in incorrect case due to fact that InnoDB code responsible for its printing for SHOW CREATE TABLE didn't have access to original parent table name. This patch solves these problems by changing SHOW CREATE TABLE code to produce foreign key descriptions from information in the SQL-layer data-dictionary. SE API which was previously used for this -- handler::get/free_foreign_key_create_info(), its implementations in InnoDB and NDB and supporting code have been removed. Note that this patch doesn't completely remove SE-specific code for printing foreign key descriptions as it is also used by SEs for error reporting. Getting rid of it requires more work and making some additional information from the data-dictionary available to SEs in these cases. As result of the above changes the behavior of SHOW CREATE TABLE for foreign keys over NDB tables has changed in the following ways: - We now put space (' ') after comma between column names in multi-column foreign keys as for InnoDB foreign keys. - We no longer show ON UPDATE/DELETE NO ACTION clauses (which are default) in SHOW CREATE TABLE output, similarly to InnoDB foreign keys. - We no longer show names of NDB mock tables in SHOW CREATE TABLE output in @@ndb_show_foreign_key_mock_tables=1 mode.
[4 Sep 2019 21:06]
Daniel Price
Posted by developer: Fixed as of the upcoming 8.0.19 release, and here's the changelog entry: In read-only mode (innodb_read_only=ON), SHOW CREATE TABLE output did not include information about foreign key constraints.