Closed
Description
Version
1.17.2
What happened?
I'm trying to use a nested common table expression with sqlc. The query works fine in Postgres sqlc throws an error.
The query in it's current form doesn't make sense since it can be simplified, however to hide the real-world complexity and just show the error that occurs the query is simplified.
Relevant log output
sqlc generate failed.
# package db
/query.sql:9:1: relation "summary" does not exist
Database schema
CREATE TABLE random_table (
foo numeric not null,
bar numeric not null
);
SQL queries
-- name: GetFoo :many
WITH steps AS(
WITH summary AS(
select
*
from random_table
)
SELECT
*
FROM summary
)
SELECT
*
FROM
steps as s;
Configuration
No response
Playground URL
https://play.sqlc.dev/p/7748d7b8fcb41011cce96416de3d454532b1ee61df6ba53e78aa0654d8985583
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go