Opened 3 years ago

Last modified 12 months ago

#33482 closed Bug

filter on exists-subquery with emoty queryset removes whole WHERE block — at Initial Version

Reported by: Tobias Bengfort Owned by: nobody
Component: Database layer (models, ORM) Version: 4.0
Severity: Normal Keywords: orm, EmptyResultSet, Exists
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

`

qs = MyModel.objects.filter(~models.Exists(MyModel.objects.none()), name='test')
qs

<QuerySet []>

print(qs.query)

EmptyResultSet
`

With django-debug-toolbar I can still see the query, but there WHERE block is missing completely.

This seems to be very similar to #33018.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top