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
In v1.11.0, when I use an alias for a subquery table, sqlc will report an error for table alias does not exist, but when I change version to v1.10.0 everything is fine
Relevant log output
table alias"subtable" does not exist
Database schema
No response
SQL queries
`select a.namefrom (a subquery) as awhere a.id=?`
Configuration
No response
Playground URL
No response
What operating system are you using?
macOS
What database engines are you using?
MySQL
What type of code are you generating?
Go
Reacted by Daniel Simmons, Jille Timmermans, Santiago Gonzalez and Thomas CASTELLY
Also wanted to mention this is only an issue when you have subquery_alias.column = $<placeholder> subquery_alias.column = 'static_value' works just fine
Reacted by ChurchOfTheSubgenius, Julian Figueroa, Maxim Motyshen, dmdv and Ivan V
Hi everyone
This error persist since 2022.
Can someone ping the pull request #3220
How one can possibly work without CTE or joins?
Is SQLC only for primitive cases?
Activity
david-alza commentedon Jul 6, 2022
Just wanted to add that this also affects Postgres in both CTE's and subqueries. Here's two very simple (and contrived) examples:
Subquery: https://play.sqlc.dev/p/cf2acd78ff8b83b83a063e13279341de0ddd7dfa7c27a6be7506d90fec3d7aa5
CTE: https://play.sqlc.dev/p/8ce7e58a669066fd890a557ed9fbaaebb3902cf83cd6890ba5a5cfe95805cc75
tcastelly commentedon Nov 29, 2022
Hello,
Does someone has a workaround?
ChurchOfTheSubgenius commentedon May 10, 2023
Any update on this?
smantic commentedon Jun 1, 2023
casting the type of the placeholder seems to be a work around.
See: https://play.sqlc.dev/p/13001a43c6063935dd690269b5e9c640a9632f3f478680b628724e1da9cf6483
Also wanted to mention this is only an issue when you have
subquery_alias.column = $<placeholder>subquery_alias.column = 'static_value'works just fineDmdv commentedon May 15, 2024
Hi everyone
This error persist since 2022.
Can someone ping the pull request #3220
How one can possibly work without CTE or joins?
Is SQLC only for primitive cases?
Please, pay attention to issues:
#2400
#3169
#1385
Though the solution of @smantic works well:
#1385 (comment)