#36552: Repeating QuerySet.filter() generates unwanted LEFT OUTER JOINs
-------------------------------------+-------------------------------------
     Reporter:  Márton Salomváry     |                    Owner:  (none)
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  chained-filters      |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 > What I can't decide is whether what I am seeing is another bug
 introduced by that bugfix, or I have been successfully relying on the
 existence of bug for quite long :)

 I can confirm that when support for conditional expressions passing to
 `filter` was added in #25367 the documented ''chaining'' property to avoid
 join reuse was missed (look at the tests added in
 4137fc2efce2dde48340728b8006fc6d66b9e3a5). This makes me believe the bug
 has been present since 3.0 which is when the feature was introduced.

 > In this example, count is wrongly 2 in Django 5.0 and correctly 1 in
 Django 4.x:

 This is ''expected'' as in Django 5.0 the multi-valued relationship is
 joined twice which triggers #10060.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36552#comment:7>
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/01070198dea87499-c1da2841-8de5-43f1-961f-5b657f401a88-000000%40eu-central-1.amazonses.com.

Reply via email to