Repository navigation
Fix analyzer conflict between a column alias and a table expression alias - #115714
Conversation
…lias `QueryExpressionsAliasVisitor` speculatively registers an aliased short identifier from expression sections (e.g. the projection `number AS test_name`) in the table expression alias map, because such an alias can transitively name a table expression. When a table expression in the FROM section had the same alias, its registration in `resolveQueryJoinTreeNode` collided with the speculative entry and the query was rejected with `MULTIPLE_EXPRESSIONS_FOR_ALIAS`. Let the actual table expression take over the alias in the table expression namespace, matching the old analyzer behavior. Genuine duplicate aliases between table expressions are still rejected by `TableExpressionsAliasVisitor`. Example: #79966 Co-Authored-By: Claude Fable 5 <[email protected]>
|
Workflow [PR], commit [c068f58] Summary: ✅
AI ReviewSummaryThis PR fixes the analyzer regression where a speculative table-expression alias collected from an identifier alias could wrongly block a real alias from the Final Verdict✅ Approve. LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 13/13 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction. Compile time of recompiled translation units7 translation units recompiled, 17 s compile time in total, 7 of them have a recent master baseline. |
…s and a table expression alias
Backport #115714 to 26.7: Fix analyzer conflict between a column alias and a table expression alias
…s and a table expression alias
Backport #115714 to 26.6: Fix analyzer conflict between a column alias and a table expression alias
Closes: #79966
Related: #66143
The analyzer rejected queries where a column alias coincides with the alias of a table expression in the
FROMsection:This is a regression from #66143 (25.2):
QueryExpressionsAliasVisitorstarted to speculatively register aliased short identifiers from expression sections (e.g. the projectionnumber AS test_name) in the table expression alias map, because such an alias can transitively name a table expression. When a table expression in theFROMsection has the same alias, its registration inresolveQueryJoinTreeNodecollided with the speculative entry, and the query was rejected. The same conflict also affected aliases ofARRAY JOINresult columns and identifier aliases defined in theWITHsection.Now the actual table expression takes over the alias in the table expression namespace, which matches the old analyzer behavior: a column alias and a table expression alias live in different namespaces, and for table lookups the alias from the
FROMsection wins. Genuine duplicate aliases between table expressions are still rejected byTableExpressionsAliasVisitor, which runs before this code.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix the
MULTIPLE_EXPRESSIONS_FOR_ALIASerror in queries where a column alias coincides with the alias of a table expression in theFROMsection (an analyzer regression in version 25.2).Workflow [PR]
Sync PR [sync-upstream/pr/115714]
Version info
26.7.10.6,26.6.9.12