Skip to content

MDEV-39977: database prefix is dropped in explain plan note - #5325

Merged
bsrikanth-mariadb merged 1 commit into
mainfrom
13.1-MDEV-39977-query-explain-note-changes-after-view-creation
Jul 16, 2026
Merged

MDEV-39977: database prefix is dropped in explain plan note#5325
bsrikanth-mariadb merged 1 commit into
mainfrom
13.1-MDEV-39977-query-explain-note-changes-after-view-creation

Conversation

@bsrikanth-mariadb

Copy link
Copy Markdown
Contributor

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread sql/table.cc
Comment on lines 5953 to +5956
if (thd->lex->need_correct_ident())
alias_name_used= !s->table_name.streq(tl->alias);
else
alias_name_used= FALSE;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Follow the project's specific coding standards for code formatting and spacing, such as spacing around assignment operators, rather than generic style guides. (link)

@spetrunia spetrunia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to push

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.
@bsrikanth-mariadb
bsrikanth-mariadb force-pushed the 13.1-MDEV-39977-query-explain-note-changes-after-view-creation branch from f1f7252 to 199a4dd Compare July 16, 2026 01:56
@bsrikanth-mariadb
bsrikanth-mariadb merged commit 199a4dd into main Jul 16, 2026
17 of 19 checks passed
@grooverdan
grooverdan deleted the 13.1-MDEV-39977-query-explain-note-changes-after-view-creation branch July 16, 2026 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants