Opened 4 years ago
Last modified 2 years ago
#33482 closed Bug
filter on exists-subquery with emoty queryset removes whole WHERE block — at Version 2
| 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 (last modified by )
>>> 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 (2)
comment:1 by , 4 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 4 years ago
| Description: | modified (diff) |
|---|
Note:
See TracTickets
for help on using tickets.