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 selecting * from a subquery, the generated query selects all columns from all tables referenced in the subquery, not all fields selected by the subquery.
With the example provided below, the following query is generated:
SELECTt.id, authors.id, name, bio FROM (select id from authors) t
The generated query should be:
SELECTt.idFROM (select id from authors) t
If you modify the query to be:
SELECT t.*FROM (select id from authors) t;
then the generated query is correct.
Relevant log output
No response
Database schema
CREATETABLEauthors (
id BIGSERIALPRIMARY KEY,
name textNOT NULL,
bio text
);
… retrieving table listing (#2573)
* fix(compiler): Fix to not scan children under ast.RangeSubselect when retrieving table listing
close#2569
* test: add endtoend
Uh oh!
There was an error while loading. Please reload this page.
Version
1.20.0
What happened?
When selecting
*
from a subquery, the generated query selects all columns from all tables referenced in the subquery, not all fields selected by the subquery.With the example provided below, the following query is generated:
The generated query should be:
If you modify the query to be:
then the generated query is correct.
Relevant log output
No response
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/40aa4c5ab1bd5efb90024e9b35a08cdc83d28237ba2bfdc2f3ecf4ec47da4c68
What operating system are you using?
Linux
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: