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

fix: losing aliasMap in 'partial' subqueries #13

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

falkenhawk
Copy link
Member

@falkenhawk falkenhawk commented Dec 22, 2022

This fixes an issue with 'partial' subqueries that they lose aliasMap from q._context (QueryBuilder's "internal context") while generating nested where sql part. QueryBuilder.subqueryOf() used to grab context from "parent" query, but it doesn't anymore. (since 2019-02-13) Vincit@524e0be

In our case, we were getting SQL errors where alias was necessary to make it work, but it was missing

ER_NON_UNIQ_ERROR: Column 'event_id' in IN/ALL/ANY subquery is ambiguous

Basically reintroducing what was deleted in Vincit@524e0be (to fix Vincit#1205) but wrap merging context with a condition that it should only apply to "partial" subqueries + reverse the sequence that isPartial() is set before subqueryOf()

This fixes an issue with 'partial' suibqueries that they lose `aliasMap` from `q._context`
(QueryBuilder's "internal context") while generating nested `where` sql part.
`QueryBuilder.subqueryOf()` used to grab context from "parent" query, but it doesn't anymore. (since 2019-02-13)
Vincit@524e0be

Basically reintroducing what was deleted in Vincit@524e0be but wrap merging context with a condition that it should only apply to "partial" subqueries + reverse the sequence that `isPartial()` is set before `subqueryOf()`
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.

Subqueries break upgrading from 1.4.0 to 1.5.3
2 participants