Skip to content

Commit 5f62020

Browse files
authored
Merge pull request pingcap#5 from xiongjiwei/fix-cte-as-bug
fix cte as bug
2 parents f06860e + e8c8b06 commit 5f62020

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

planner/core/logical_plan_builder.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3650,10 +3650,10 @@ func (b *PlanBuilder) buildDataSource(ctx context.Context, tn *ast.TableName, as
36503650
p.SetSchema(cte.seedLP.Schema())
36513651
p.SetOutputNames(cte.seedLP.OutputNames())
36523652
if len(asName.String()) > 0 {
3653-
on := p.OutputNames()
3654-
for i := range on {
3655-
cpOn := *on[i]
3656-
on[i] = &cpOn
3653+
var on types.NameSlice
3654+
for _, name := range p.OutputNames() {
3655+
cpOn := *name
3656+
on = append(on, &cpOn)
36573657
on[i].TblName = *asName
36583658
}
36593659
p.SetOutputNames(on)

0 commit comments

Comments
 (0)