- Notifications
You must be signed in to change notification settings - Fork 978
Closed
Description
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() in output_columns.go I believe.
Relevant log output
query.sql:9:1: column reference "name" is ambiguous: if you want to skip this validation, set'strict_order_by' to falseDatabase schema
CREATETABLEauthors ( id BIGSERIALPRIMARY KEY, name textNOT NULL, bio text );SQL queries
SELECTa.nameFROM authors a JOIN authors b ONa.id=b.idORDER BY name; SELECTa.nameAS name FROM authors a JOIN authors b ONa.id=b.idORDER BY name;Configuration
{"version": "1","packages": [{"path": "db","engine": "postgresql","schema": "query.sql","queries": "query.sql"}]}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