sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.57k stars 812 forks source link

Star expansion failed for query #2915

Open kyleconroy opened 1 year ago

kyleconroy commented 1 year ago

Version

1.23.0

What happened?

Generating code for a query with star expansion didn't work.

Relevant log output

# package db
query.sql:1:1: star expansion failed for query

Database schema

No response

SQL queries

WITH total AS (
    WITH a AS (
        SELECT 1 AS col1, 2 AS col2
    ),
    b AS (
        SELECT 1 AS col1, 3 AS col3
    )
    SELECT *
    FROM a
    FULL JOIN b USING (col1)
)
SELECT * FROM total;

Configuration

version: "2"
cloud:
  project: "<PROJECT_ID>"
sql:
- schema: "schema.sql"
  queries: "query.sql"
  engine: "postgresql"
  database:
    managed: true
  gen:
    go:
      out: db
      sql_package: "pgx/v5"

Playground URL

https://play.sqlc.dev/p/4f4fbdba61dc9fc8a64a5c57f71e814e56183baf46966d254864f5dc3b0d2c4c

What operating system are you using?

macOS

What database engines are you using?

PostgreSQL

What type of code are you generating?

Go

meghb commented 12 months ago

@kyleconroy thanks for the great work. do we have any update on when this can be fixed? We have a lot of CTEs with star queries and it would help if this is fixed, we are currently having to expand out the queries which is less than ideal