#36025: __range lookup in conditional aggregate with subquery annotation does 
not
use annotated related fields
-------------------------------------+-------------------------------------
     Reporter:  Aashay Amballi       |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  4.2
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  fixed
     Keywords:  ORM                  |             Triage Stage:  Ready for
                                     |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Sarah Boyce <42296566+sarahboyce@…>):

 In [changeset:"d99985bbc121749c5a6bb9eb9a4a9099b6a002eb" d99985b]:
 {{{#!CommitTicketReference repository=""
 revision="d99985bbc121749c5a6bb9eb9a4a9099b6a002eb"
 [5.2.x] Fixed #36025 -- Fixed re-aliasing of iterable (in/range) lookups
 rhs.

 In order for Expression.relabeled_clone to work appropriately its
 get_source_expressions method must return all resolvable which wasn't the
 case
 for Lookup when its right-hand-side is "direct" (not a compilable).

 While refs #22288 added support for non-literals iterable right-hand-side
 lookups it predated the subclassing of Lookup(Expression) refs #27021
 which
 could have been an opportunity to ensure right-hand-sides are always
 resolvable
 (ValueList and ExpressionList).

 Addressing all edge case with non-resolvable right-hand-sides would
 require
 a significant refactor and deprecation of some parts of the Lookup
 interface so
 this patch only focuses on FieldGetDbPrepValueIterableMixin (In and Range
 lookups) by making sure that a right-hand-side containing resolvables are
 dealt
 with appropriately during the resolving phase.

 Thanks Aashay Amballi for the report.

 Backport of 089deb82b9ac2d002af36fd36f288368cdac4b53 from main.
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36025#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070194dc0013b2-52db2a15-d518-4350-b924-fdcbb7a0c993-000000%40eu-central-1.amazonses.com.

Reply via email to