MDEV-39977: database prefix is dropped in explain plan note - #5325
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates TABLE::init in sql/table.cc to explicitly set alias_name_used to FALSE when thd->lex->need_correct_ident() is false, which updates identifier qualification in query outputs as shown in the test result changes. The review feedback suggests simplifying this conditional assignment into a single expression to avoid if-else branching and the legacy FALSE macro.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (thd->lex->need_correct_ident()) | ||
| alias_name_used= !s->table_name.streq(tl->alias); | ||
| else | ||
| alias_name_used= FALSE; |
There was a problem hiding this comment.
The conditional assignment to alias_name_used can be simplified into a single, concise expression. This avoids the if-else branching and uses idiomatic C++ logical operators instead of the legacy FALSE macro.
alias_name_used= thd->lex->need_correct_ident() &&
!s->table_name.streq(tl->alias);References
- Follow the project's specific coding standards for code formatting and spacing, such as spacing around assignment operators, rather than generic style guides. (link)
The prefix database_name was getting dropped in the explain extended plan note for certain non-view blocks of queries. alias_name_used field in the table is not initialized correctly in all the query blocks. This PR makes the database prefix to be added before the [alias] table name consistently when they are part of the non-view query blocks.
f1f7252 to
199a4dd
Compare
The prefix database_name was getting dropped in the explain extended plan note for certain non-view blocks of queries.
alias_name_used field in the table is not initialized correctly in all the query blocks.
This PR makes the database prefix to be added before the [alias] table name consistently when they are part of the non-view query blocks.