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
When using a subquery, if I specify an output column name for GROUP BY, sqlc cannot compile it. if I execute SQL directly, it works fine.
I am aware that when using PostgreSQL, column output names can be specified as GROUP BY. However, if I am mistaken, please let me know.
Relevant log output
No response
Database schema
CREATETABLEspam (
id SERIALPRIMARY KEY
);
SQL queries
-- name: Spam :manySELECTs.idAS"s_id"FROM-- Using subqueries doesn't work.
(
SELECTspam.idFROM spam
) AS"s"-- Change this to s.id and it will work.GROUP BY s_id;
Alias column names don't exist in the table definition. When we take
it from the select target list, we only need to do this once (and not
once for every table in a join statement).
Refs: sqlc-dev#2398sqlc-dev#1886
… joins (#2537)
* fix(compiler): correctly validate alias in order/group by clauses for joins
Resolves#1886Resolves#2398Resolves#2399
* remove dead code and split up test
Version
1.15.0
What happened?
When using a subquery, if I specify an output column name for GROUP BY, sqlc cannot compile it. if I execute SQL directly, it works fine.
I am aware that when using PostgreSQL, column output names can be specified as GROUP BY. However, if I am mistaken, please let me know.
Relevant log output
No response
Database schema
SQL queries
Configuration
No response
Playground URL
https://play.sqlc.dev/p/b3ae0c313bd30c061316dc729e285eba780ba4c7c94e4a44eaac81c619ce9c99
What operating system are you using?
macOS
What database engines are you using?
PostgreSQL
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: