Skip to content
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

All not needed an alias when there is a subquery with the same column name #2639

Closed
wants to merge 3 commits into from

Conversation

ovadbar
Copy link
Contributor

@ovadbar ovadbar commented Aug 20, 2023

No description provided.

@andrewmbenton
Copy link
Collaborator

Is the goal of this change to resolve the sqlc ambiguous column reference error that's generated with the current version when you run the example you provided in endtoend/testdata/subquery_with_where? (Here's a playground link with that example: https://play.sqlc.dev/p/fa36355b5c64f2618f93d76151d3d160cd329e00ec612cab0cdfe0d9c76874eb)

If so I think this is probably more effort than it's worth when the workaround isn't too onerous (just prefix the column names in where clauses with their table names explicitly).

@ovadbar
Copy link
Contributor Author

ovadbar commented Aug 22, 2023

Is the goal of this change to resolve the sqlc ambiguous column reference error that's generated with the current version when you run the example you provided in endtoend/testdata/subquery_with_where? (Here's a playground link with that example: https://play.sqlc.dev/p/fa36355b5c64f2618f93d76151d3d160cd329e00ec612cab0cdfe0d9c76874eb)

If so I think this is probably more effort than it's worth when the workaround isn't too onerous (just prefix the column names in where clauses with their table names explicitly).

Yeah that is the goal of this merge request. While the workaround isn't too onerous as I've been doing it for a long time, It was not super complicated to get it working. And I run into this too often that it is an annoyance.

@andrei-dascalu
Copy link

@andrewmbenton the workaround doesn't play well with multiple joins on the same table, particularly when one of the joins may be nullable. It also doesn't work when you need to select all the fields - works for a particular field.

andrewmbenton added a commit that referenced this pull request Oct 17, 2023
kyleconroy pushed a commit that referenced this pull request Oct 17, 2023
* test: Add a test case for #1739

* test: Add a test case for #2639
@kyleconroy
Copy link
Collaborator

This should be fixed in v1.23.0 by enabling the database-backed query analyzer. If not, please open a new issue.

@kyleconroy kyleconroy closed this Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants