| Bug #115171 | The logic in the `ha_resolve_by_name` function is incorrect when retrieving the | ||
|---|---|---|---|
| Submitted: | 30 May 2024 2:26 | Modified: | 30 May 2024 9:47 |
| Reporter: | wang huai | Email Updates: | |
| Status: | Unsupported | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 8.0.23 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | DEFAULT, engine, MYSQL SERVER | ||
[30 May 2024 9:47]
MySQL Verification Team
HI Mr. Huai, Thank you for your bug report. However, this is not a bug. First of all, 8.0.23 is a very, very old release and is not supported any more. Next, this function, in the current release, has changed significantly. Last, but not least, your explanation of why is that function incorrect is highly unclear and without any in-depth analysis of the code flow. It does not even contains a source code file name. Unsupported.

Description: plugin_ref ha_resolve_by_name(THD *thd, const LEX_CSTRING *name, bool is_temp_table) { if (thd && 0 == strnncmp_nopads(hton_charset(), *name, {STRING_WITH_LEN("DEFAULT")})) { return is_temp_table ? ha_default_plugin(thd) : ha_default_temp_plugin(thd); } .... } Please look at the function `ha_resolve_by_name`. If `is_temp_table` is true, then the default engine for temporary tables needs to be returned. If `is_temp_table` is false, the default engine for regular tables should be returned. However, the expression "is_temp_table ? ha_default_plugin(thd) : ha_default_temp_plugin(thd);" shows that the logic is exactly the opposite. How to repeat: no need Suggested fix: after modified: plugin_ref ha_resolve_by_name(THD *thd, const LEX_CSTRING *name, bool is_temp_table) { if (thd && 0 == strnncmp_nopads(hton_charset(), *name, {STRING_WITH_LEN("DEFAULT")})) { return is_temp_table ? ha_default_temp_plugin(thd) : ha_default_plugin(thd); } .... }