sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

*ast.ResTarget has nil name error when using common table expression

Open Mehgugs opened this issue 5 months ago • 0 comments

Version

1.28.0

What happened?

This query cannot be parsed by sqlc using the sqlite engine:

with params (foo) as (select ?) 
select * from params;

I can run this query via vanilla database/sql using the github.com/mattn/go-sqlite3 driver and it works perfectly fine, so I would expect it to be parsed correctly by sqlc.

Relevant log output

sqlc generate
# package database
sql\queries.sql:123:1: *ast.ResTarget has nil name

Database schema


SQL queries

with params (foo) as (select ?) 
select * from params;

Configuration

version: "2"
sql:
  - engine: "sqlite"
    queries: "sql/queries.sql"
    schema: "sql/migrations"
    gen:
      go:
        package: "database"
        out: "database"

Playground URL

https://play.sqlc.dev/p/d59d0a0a69692444c6b08485fd9b175d0c26b8c58afe5684973e91268f41f58b

What operating system are you using?

Windows

What database engines are you using?

SQLite

What type of code are you generating?

Go

Mehgugs avatar Jun 16 '25 08:06 Mehgugs