summaryrefslogtreecommitdiff
path: root/tests/expressions
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2022-02-01 13:27:41 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-02 07:54:19 +0100
commitb7d1da5a62fe4141beff2bfea565f7ef0038c94c (patch)
tree5aa3e2172056bb5fa8d701f433f52a4c3018dab0 /tests/expressions
parent770d3e6a4ce8e0a91a9e27156036c1985e74d4a3 (diff)
downloaddjango-b7d1da5a62fe4141beff2bfea565f7ef0038c94c.tar.gz
Fixed #33482 -- Fixed QuerySet filtering againts negated Exists() with empty queryset.
Thanks Tobias Bengfort for the report.
Diffstat (limited to 'tests/expressions')
-rw-r--r--tests/expressions/tests.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 5cf9dd1ea5..89c6a7c8de 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -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):