#33482: filter on exists-subquery with empty queryset removes whole WHERE block
-------------------------------------+-------------------------------------
     Reporter:  Tobias Bengfort      |                    Owner:  Simon
                                     |  Charette
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  4.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  orm,                 |             Triage Stage:  Ready for
  EmptyResultSet, Exists             |  checkin
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tobias Bengfort):

 * status:  closed => new
 * resolution:  fixed =>


Comment:

 I still get this error in 4.2 if I include the empty exists expression in
 the filter:

 {{{
 def test_filter_by_empty_exists(self):
     manager = Manager.objects.create()
     qs = Manager.objects.annotate(
         exists=Exists(Manager.objects.none())
     ).filter(pk=manager.pk, exists=False)
     self.assertSequenceEqual(qs, [manager])
     self.assertIs(qs.get().exists, False)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33482#comment:9>
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 on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018afb075847-fe6ce79a-461f-4222-a884-f5d59b51ee35-000000%40eu-central-1.amazonses.com.

Reply via email to