Closed
Description
Version
1.15.0
What happened?
I try to generate go code with a recursive CTE, which uses UNION ALL
and it fails.
My query is quite complex, but here is a simple reproduction:
Relevant log output
query.sql:7:8: column "n" does not exist
Database schema
None
SQL queries
-- name: CTERecursive :many
WITH RECURSIVE t(n) AS (
VALUES (1)
UNION ALL
SELECT n+1 FROM t WHERE n < 100
)
SELECT n FROM t;
Configuration
{
"version": "1",
"packages": [
{
"path": "go",
"name": "querytest",
"schema": "query.sql",
"queries": "query.sql"
}
]
}
Playground URL
https://play.sqlc.dev/p/5c0c86493af9912a8d54ab083a92edcd4105ea8baf30681e1abe761a0cce1246
What operating system are you using?
Linux
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go