mirror of
https://github.com/django/django.git
synced 2025-09-06 18:50:55 +00:00
Fixed #33482 -- Fixed QuerySet filtering againts negated Exists() with empty queryset.
Thanks Tobias Bengfort for the report.
This commit is contained in:
parent
770d3e6a4c
commit
b7d1da5a62
2 changed files with 19 additions and 7 deletions
|
@ -1905,6 +1905,13 @@ class ExistsTests(TestCase):
|
|||
)
|
||||
self.assertNotIn('ORDER BY', captured_sql)
|
||||
|
||||
def test_negated_empty_exists(self):
|
||||
manager = Manager.objects.create()
|
||||
qs = Manager.objects.filter(
|
||||
~Exists(Manager.objects.none()) & Q(pk=manager.pk)
|
||||
)
|
||||
self.assertSequenceEqual(qs, [manager])
|
||||
|
||||
|
||||
class FieldTransformTests(TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue