Title: `Group by` and `left join using` gives a "column reference is ambiguous · Issue #1425 · sqlc-dev/sqlc · GitHub
Open Graph Title: `Group by` and `left join using` gives a "column reference is ambiguous · Issue #1425 · sqlc-dev/sqlc
X Title: `Group by` and `left join using` gives a "column reference is ambiguous · Issue #1425 · sqlc-dev/sqlc
Description: Version 1.12.0 What happened? When using join ... using (key) group by key, sqlc seems to think key references the columns in the joined tables instead of the synthetic key column generated by using. where and having doesn't seem to have...
Open Graph Description: Version 1.12.0 What happened? When using join ... using (key) group by key, sqlc seems to think key references the columns in the joined tables instead of the synthetic key column generated by usin...
X Description: Version 1.12.0 What happened? When using join ... using (key) group by key, sqlc seems to think key references the columns in the joined tables instead of the synthetic key column generated by usin...
Opengraph URL: https://github.com/sqlc-dev/sqlc/issues/1425
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`Group by` and `left join using` gives a \"column reference is ambiguous","articleBody":"### Version\r\n\r\n1.12.0\r\n\r\n### What happened?\r\n\r\nWhen using `join ... using (key) group by key`, sqlc seems to think `key` references the columns in the joined tables instead of the synthetic `key` column generated by `using`. `where` and `having` doesn't seem to have this problem, they work as expected.\r\n\r\nThis seem to be a regression since I have no problem with this kind of query in the 1.10.0 I use.\r\n\r\n### Relevant log output\r\n\r\n```shell\r\nsqlc generate failed.\r\n\r\n# package db\r\nquery.sql:7:46: column reference \"fk\" is ambiguous\r\n```\r\n\r\n\r\n### Database schema\r\n\r\n```sql\r\ncreate table t1 (\r\n fk integer not null unique\r\n);\r\ncreate table t2 (\r\n fk integer not null references t1(fk)\r\n);\r\n```\r\n\r\n\r\n### SQL queries\r\n\r\n```sql\r\nselect * from t1 join t2 using (fk) group by fk;\r\n```\r\n\r\n\r\n### Configuration\r\n\r\n_No response_\r\n\r\n### Playground URL\r\n\r\nhttps://play.sqlc.dev/p/f9717de599d83359e7f1fdf15bbe7e3ed9cb57ce7c6b4c9dd6576a6445b140cd\r\n\r\n### What operating system are you using?\r\n\r\n_No response_\r\n\r\n### What database engines are you using?\r\n\r\nPostgreSQL\r\n\r\n### What type of code are you generating?\r\n\r\n_No response_","author":{"url":"https://github.com/Yamakaky","@type":"Person","name":"Yamakaky"},"datePublished":"2022-02-10T10:16:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/1425/sqlc/issues/1425"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cf9dcd67-d508-1210-818b-9106575ec0a5 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AC62:3F0628:AB81F85:AEE73E0:6A50B220 |
| html-safe-nonce | efa550c3881258198c4e39393ef43b4202cabd8405965cd73ca16069555b7398 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQzYyOjNGMDYyODpBQjgxRjg1OkFFRTczRTA6NkE1MEIyMjAiLCJ2aXNpdG9yX2lkIjoiNDgzOTE4OTE3MDg2NDgyODk2MCIsInJlZ2lvbl9lZGdlIjoic2VhIiwicmVnaW9uX3JlbmRlciI6InNlYSJ9 |
| visitor-hmac | 3262f1427ef049b1ecab49b23e222ecf20576aa2ec2b642f73a6f5f43911b647 |
| hovercard-subject-tag | issue:1129774789 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/sqlc-dev/sqlc/1425/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7df54b56f4a7cd843229c88b721bcfba616acab8913c7007604c97e83ccc7f9d/sqlc-dev/sqlc/issues/1425 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7df54b56f4a7cd843229c88b721bcfba616acab8913c7007604c97e83ccc7f9d/sqlc-dev/sqlc/issues/1425 |
| og:image:alt | Version 1.12.0 What happened? When using join ... using (key) group by key, sqlc seems to think key references the columns in the joined tables instead of the synthetic key column generated by usin... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Yamakaky |
| hostname | github.com |
| expected-hostname | github.com |
| None | 63772747707af4093f0d5fc7aa1bb3bb55f412a9865207c4f421aa34c64cc404 |
| turbo-cache-control | no-preview |
| go-import | github.com/sqlc-dev/sqlc git https://github.com/sqlc-dev/sqlc.git |
| octolytics-dimension-user_id | 136738596 |
| octolytics-dimension-user_login | sqlc-dev |
| octolytics-dimension-repository_id | 193160679 |
| octolytics-dimension-repository_nwo | sqlc-dev/sqlc |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 193160679 |
| octolytics-dimension-repository_network_root_nwo | sqlc-dev/sqlc |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ded53fe94e3ff1bb4dbf8cc77e285396c92580fb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width