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

Fixed #29545 -- Fixed using filter lookups againts nested subquery expressions. #11677

Merged
merged 1 commit into from
Aug 17, 2019

Conversation

charettes
Copy link
Member

This is necessary to allow filter lookups against nested subquery expressions to properly resolve their OuterRefs to Cols.

Thanks Oskar Persson for the simplified test case.

@felixxm felixxm self-assigned this Aug 17, 2019
@felixxm felixxm changed the title Fixed #29545 -- Made sql.Where resolve lhs of its child nodes. Fixed #29545 -- Fixed using filter lookups againts nested subquery expressions. Aug 17, 2019
…pressions.

Made sql.Where resolve lhs of its child nodes. This is necessary to
allow filter lookups against nested subquery expressions to properly
resolve their OuterRefs to Cols.

Thanks Oskar Persson for the simplified test case.
@felixxm felixxm merged commit 8b4a43d into django:master Aug 17, 2019
@felixxm
Copy link
Member

felixxm commented Aug 17, 2019

@charettes Thanks 🚀

@OskarPersson
Copy link

Is there any chance we will see this in 2.2.5? I can't see it listed in the changelog

@felixxm
Copy link
Member

felixxm commented Aug 28, 2019

@OskarPersson No, this patch doesn't qualify for a backport.

@OskarPersson
Copy link

Why is that? What makes a patch qualify for a backport or not, especially for a LTS?

@felixxm
Copy link
Member

felixxm commented Aug 28, 2019

It is not a regression or a bug in a new feature.

@OskarPersson
Copy link

OskarPersson commented Aug 28, 2019

I'm sorry, but doesn't it collide with the documentation for the same release then? Isn't the following statement incorrect without this patch? Without it, it would crash.

Instances of OuterRef may be used in conjunction with nested instances of Subquery to refer to a containing queryset that isn’t the immediate parent.

https://docs.djangoproject.com/en/2.2/ref/models/expressions/#referencing-columns-from-the-outer-queryset

@felixxm
Copy link
Member

felixxm commented Aug 28, 2019

First of all this works in most of cases, issue is only when resolving nested subqueries used in lhs. Secondly Subquery is not a feature added in Django 2.2 and this issue was in Django since 2.0.

@OskarPersson
Copy link

I see, guess I'll keep my workarounds for 3.0 then :)

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.

3 participants