Skip to content

Commit ddc4a54

Browse files
committed
Remove native backend marking for CTEs - let normal indirect processing handle them
1 parent 1902f62 commit ddc4a54

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/stackql/astanalysis/earlyanalysis/ast_expand.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,16 +843,13 @@ func (v *indirectExpandAstVisitor) Visit(node sqlparser.SQLNode) error {
843843
cteName := node.Name.GetRawVal()
844844
if cte, isCTE := v.cteRegistry[cteName]; isCTE {
845845
// This is a CTE reference - create and register an indirect.
846-
// CTEs are handled differently from views/subqueries - their SELECT
847-
// is already processed when we visit the WITH clause.
846+
// The CTE's inner SELECT has already been visited when processing
847+
// the WITH clause, so the API tables within it will be processed.
848848
indirect, err := astindirect.NewCTEIndirect(cte)
849849
if err != nil {
850850
return err
851851
}
852852
v.annotatedAST.SetIndirect(node, indirect)
853-
// Mark that we contain native backend material since CTE results
854-
// are stored in the SQL backend.
855-
v.containsNativeBackendMaterial = true
856853
return nil
857854
}
858855
containsBackendMaterial := v.handlerCtx.GetDBMSInternalRouter().ExprIsRoutable(node)

0 commit comments

Comments
 (0)