You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to do a more efficient distinct query (the second query) and noticed that the generation panics on the alias of a subquery. The first query shows a simpler example on how to cause this issue.
panic: walk: unexpected node type *pg_query.Alias
-- schema.sqlCREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name TEXTNOT NULL,
bio TEXT
);
-- name: SubAuthors :manySELECTsub.nameFROM (SELECT*FROM authors) sub
-- name: ListDistinctAuthors :many
WITH RECURSIVE temp (t) AS (
(SELECT name from authors LIMIT1)
UNION ALL
(SELECT name FROM temp, LATERAL (SELECT name FROM authors where name > t LIMIT1) sub)
)
SELECT t from temp;
Activity
internal/dinosql: Dereference alias nodes on walk
internal/dinosql: Dereference alias nodes on walk (#158)