Skip to content

Commit

Permalink
planner: fix error when select view_name.col_name from view_name(#14314
Browse files Browse the repository at this point in the history
…) (#15573)
  • Loading branch information
XuHuaiyu authored Mar 24, 2020
1 parent 20f03b3 commit f3de03d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2562,7 +2562,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,
OrigTblName: col.OrigTblName,
ColName: columnInfo[i].Name,
OrigColName: origColName,
Expand Down
4 changes: 4 additions & 0 deletions planner/core/logical_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2231,6 +2231,10 @@ func (s *testPlanSuite) TestSelectView(c *C) {
sql: "select * from v",
best: "DataScan(t)->Projection",
},
{
sql: "select v.b, v.c, v.d from v",
best: "DataScan(t)->Projection",
},
}
ctx := context.TODO()
for i, tt := range tests {
Expand Down

0 comments on commit f3de03d

Please sign in to comment.