-
Notifications
You must be signed in to change notification settings - Fork 813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlc hallucinates ambiguous column references when no ambiguity exists #2538
Comments
The urgency on resolving this isn't super high. The obvious workaround is to just fully qualify the column names in your order by clauses. In both queries above, using |
Still broken if you use the postgresql or mysql engines: https://play.sqlc.dev/p/3d1c2485fb8a777557b4de50bb3f7d60e17ec1a8fdcbdb42d674a5b5eae967ad |
This is fixed in v1.23.0 by enabling the database-backed query analyzer. We added a test case for this issue so it won’t break in the future. You can play around with the working example on the playground |
Version
1.19.1
What happened?
Discovered while working on #2537, sqlc returns an ambiguous column reference error for some queries which run fine with psql. See examples below.
To fix we'll need to update
findColumnForRef()
inoutput_columns.go
I believe.Relevant log output
Database schema
SQL queries
Configuration
Playground URL
https://play.sqlc.dev/p/8e9c3fa8f50201433c489b118a731130a7011574ec53d27bbe460eb1978f2f13
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: