Skip to content

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

Open
@Mehgugs

Description

@Mehgugs

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions