Skip to content

Commit bba79de

Browse files
committed
fix scope mapping
1 parent 20914a8 commit bba79de

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

enginetest/queries/query_plans.go

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sql/planbuilder/cte.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (b *Builder) buildRecursiveCte(inScope *scope, union *ast.SetOp, name strin
9090
// not recursive
9191
sqScope := inScope.pushSubquery()
9292
cteScope := b.buildSelectStmt(sqScope, union)
93-
b.renameSource(cteScope, name, columns)
93+
9494
switch n := cteScope.node.(type) {
9595
case *plan.SetOp:
9696
sq := plan.NewSubqueryAlias(name, "", n)
@@ -107,9 +107,9 @@ func (b *Builder) buildRecursiveCte(inScope *scope, union *ast.SetOp, name strin
107107
colset.Add(sql.ColumnId(c.id))
108108
scopeMapping[sql.ColumnId(c.id)] = c.scalarGf()
109109
}
110-
111110
cteScope.node = sq.WithScopeMapping(scopeMapping).WithId(tabId).WithColumns(colset)
112111
}
112+
b.renameSource(cteScope, name, columns)
113113
return cteScope
114114
}
115115

0 commit comments

Comments
 (0)