-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
planner: fix error when select view_name.col_name from view_name(#14314) #15572
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -2426,7 +2426,7 @@ func (b *PlanBuilder) buildProjUponView(ctx context.Context, dbName model.CIStr, | |||
} | |||
projSchema.Append(&expression.Column{ | |||
UniqueID: b.ctx.GetSessionVars().AllocPlanColumnID(), | |||
TblName: col.TblName, | |||
TblName: tableInfo.Name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to change DBName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@XuHuaiyu PTAL. BTW, we can merge this PR firstly. Changing the DBName
in another PR if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch.
#15611
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Your auto merge job has been accepted, waiting for 15573 |
/run-all-tests |
cherry-pick #14314
What problem does this PR solve?
Before this commit:
What is changed and how it works?
We build a projection upon the underlying select when execute
select from a view
.The output name of the built projection should be
view_name.col_name
instead ofunderlying_table_name.col_name
.Check List
Tests
Code changes
Side effects
N/A
Related changes
release-3.0, release-3.1
Release note
Fix an error when executing SQL like
select view_name.col_name from view_name
.