Skip to content

Aliasing a subquery fails to compile #159

Closed
@kyleconroy

Description

@kyleconroy

The following SQL used to cause sqlc to panic. That was fixed in #158. Sadly, sqlc still can't handle the aliasing of a subquery. When trying to compile the following SQL:

CREATE TABLE authors (
  id BIGSERIAL PRIMARY KEY,
  name TEXT NOT NULL,
  bio TEXT
);

-- name: SubAuthors :many
SELECT sub.name FROM (SELECT * FROM authors) sub

sqlc returns the following error:

query.sql:x:y: column "name" does not exist

cc @arddor

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions