summaryrefslogtreecommitdiff
path: root/tests/select_for_update
diff options
context:
space:
mode:
authorHannes Ljungberg <hannes.ljungberg@gmail.com>2021-11-03 13:28:04 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-11-03 20:08:14 +0100
commit25157033e979c134d455d46995a6db0838457d98 (patch)
tree68d4761bbe1a2a70163ad9cc66d3aca75fbd50fb /tests/select_for_update
parent447b6c866f0741bb68c92dc925a65fb15bfe7995 (diff)
downloaddjango-25157033e979c134d455d46995a6db0838457d98.tar.gz
Fixed #33260 -- Fixed crash when chaining QuerySet.exists() after select_for_update(of=()).
Diffstat (limited to 'tests/select_for_update')
-rw-r--r--tests/select_for_update/tests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/select_for_update/tests.py b/tests/select_for_update/tests.py
index 705975b760..5bae8a355a 100644
--- a/tests/select_for_update/tests.py
+++ b/tests/select_for_update/tests.py
@@ -244,6 +244,14 @@ class SelectForUpdateTests(TransactionTestCase):
values = list(Person.objects.select_related('born').select_for_update(of=('self',)).values('born__name'))
self.assertEqual(values, [{'born__name': self.city1.name}])
+ @skipUnlessDBFeature(
+ 'has_select_for_update_of', 'supports_select_for_update_with_limit',
+ )
+ def test_for_update_of_with_exists(self):
+ with transaction.atomic():
+ qs = Person.objects.select_for_update(of=('self', 'born'))
+ self.assertIs(qs.exists(), True)
+
@skipUnlessDBFeature('has_select_for_update_nowait')
def test_nowait_raises_error_on_block(self):
"""