Bug #98635 | Explain neglects db part of identifier after create view | ||
---|---|---|---|
Submitted: | 17 Feb 2020 11:38 | Modified: | 9 Jul 2021 22:49 |
Reporter: | Kaiwang CHen (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0.18, 8.0.19, 5.7.29 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[17 Feb 2020 11:38]
Kaiwang CHen
[17 Feb 2020 12:18]
MySQL Verification Team
Hello Kaiwang, Thank you for the report and contribution! Please ensure to re-send the patch via "contribution" tab. Otherwise we would not be able to accept it. regards, Umesh
[20 Feb 2020 18:47]
Kaiwang CHen
See enclosed for a fix. Note that it will causes many regressions. (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: bugfix_98635.patch (application/octet-stream, text), 4.73 KiB.
[20 Feb 2020 18:48]
Kaiwang CHen
These tests will be affected by the patch. ./mtr main.subquery_sj_all main.derived main.subquery_sj_all_bka main.subquery_sj_all_bka_nixbnl main.group_by main.subquery_sj_all_bkaunique main.subquery_sj_dupsweed main.myisam_explain_json_non_select_all main.subquery_sj_dupsweed_bka main.myisam_explain_json_non_select_none main.subquery_sj_dupsweed_bka_nixbnl main.myisam_explain_non_select_all main.myisam_explain_non_select_none main.subquery_sj_dupsweed_bkaunique main.subquery_sj_firstmatch main.subquery_sj_firstmatch_bka main.subquery_all main.subquery_all_bka_nixbnl main.subquery_nomat_nosj main.subquery_nomat_nosj_bka main.subquery_nomat_nosj_bka_nixbnl main.subquery_none main.subquery_none_bka main.subquery_none_bka_nixbnl main.subquery_sj_firstmatch_bka_nixbnl main.subquery_sj_firstmatch_bkaunique main.subquery_sj_loosescan main.subquery_sj_loosescan_bka main.subquery_sj_loosescan_bka_nixbnl main.subquery_sj_loosescan_bkaunique main.subquery_sj_mat main.subquery_sj_mat_bka main.subquery_sj_mat_bka_nixbnl main.subquery_sj_mat_bkaunique main.subquery_sj_mat_nosj main.view main.subquery_sj_none main.subquery_sj_none_bka main.subquery_sj_none_bka_nixbnl main.subquery_sj_none_bkaunique --record Logging: /Users/kaiwang.ckw/Projects/mysql-server/mysql-test/mysql-test-run.pl main.subquery_sj_all main.derived main.subquery_sj_all_bka main.subquery_sj_all_bka_nixbnl main.group_by main.subquery_sj_all_bkaunique main.subquery_sj_dupsweed main.myisam_explain_json_non_select_all main.subquery_sj_dupsweed_bka main.myisam_explain_json_non_select_none main.subquery_sj_dupsweed_bka_nixbnl main.myisam_explain_non_select_all main.myisam_explain_non_select_none main.subquery_sj_dupsweed_bkaunique main.subquery_sj_firstmatch main.subquery_sj_firstmatch_bka main.subquery_all main.subquery_all_bka_nixbnl main.subquery_nomat_nosj main.subquery_nomat_nosj_bka main.subquery_nomat_nosj_bka_nixbnl main.subquery_none main.subquery_none_bka main.subquery_none_bka_nixbnl main.subquery_sj_firstmatch_bka_nixbnl main.subquery_sj_firstmatch_bkaunique main.subquery_sj_loosescan main.subquery_sj_loosescan_bka main.subquery_sj_loosescan_bka_nixbnl main.subquery_sj_loosescan_bkaunique main.subquery_sj_mat main.subquery_sj_mat_bka main.subquery_sj_mat_bka_nixbnl main.subquery_sj_mat_bkaunique main.subquery_sj_mat_nosj main.view main.subquery_sj_none main.subquery_sj_none_bka main.subquery_sj_none_bka_nixbnl main.subquery_sj_none_bkaunique --record
[9 Jul 2021 22:49]
Jon Stephens
Documented fix as follows in the MySQL 8.0.27 changelog: The EXPLAIN output for a DML statement contains the table identifier, which normally includes the database name, in the output of SHOW WARNINGS. For some statements such as CREATE VIEW, the database name should be omitted, which is enforced by setting the alias_name_used flag to true in the cached table object, but when the cached table was reused following CREATE VIEW, the flag was not reset, which caused the database name to be omitted from the warnings following EXPLAIN for statements run after a CREATE VIEW which access the same cached table as the view. We fix this by ensuring that the alias_name_used flag is always set to an appropriate value during table initialization. Our thanks to Kaiwang Chen for the contribution. Closed.