Skip to content

Commit

Permalink
Add another test for CTE
Browse files Browse the repository at this point in the history
  • Loading branch information
EinKrebs committed Apr 25, 2024
1 parent f19a1ac commit a25f188
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion router/qrouter/proxy_routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (meta *RoutingMetadataContext) RecordConstExpr(resolvedRelation RelationFQN
meta.rels[resolvedRelation] = struct{}{}
if _, ok := meta.exprs[resolvedRelation]; !ok {
meta.exprs[resolvedRelation] = map[string]string{}
}
} // TODO: else branch
delete(meta.unparsed_columns, colname)
meta.exprs[resolvedRelation][colname] = expr
}
Expand Down
15 changes: 15 additions & 0 deletions router/qrouter/proxy_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,21 @@ func TestCTE(t *testing.T) {
TargetSessionAttrs: "any",
},
},
{
query: `
WITH xxxx AS (
SELECT * from t where i = 1
),
zzzz AS (
UPDATE t
SET a = 0
WHERE i = 12
)
SELECT * FROM xxxx;
`,
err: nil,
exp: routingstate.MultiMatchState{},
},
} {
parserRes, err := lyx.Parse(tt.query)

Expand Down

0 comments on commit a25f188

Please sign in to comment.