summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2025-05-14 22:49:52 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-05-16 08:19:38 +0200
commit994dc6d8a1bae717baa236b65e11cf91ce181c53 (patch)
tree09e1a4ebf601e5052cd466163d1b9dced4f4a50e /tests
parente03e5c751c56db5f4cb99e142c92d7d8db3a5463 (diff)
Fixed #36392 -- Raised ValueError when subquery referencing composite pk selects too many columns.
Diffstat (limited to 'tests')
-rw-r--r--tests/composite_pk/test_filter.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/composite_pk/test_filter.py b/tests/composite_pk/test_filter.py
index 39f19daecc..c00b6660d8 100644
--- a/tests/composite_pk/test_filter.py
+++ b/tests/composite_pk/test_filter.py
@@ -206,6 +206,14 @@ class CompositePKFilterTests(TestCase):
[self.comment_1],
)
+ def test_filter_by_pk_in_subquery_invalid_selected_columns(self):
+ msg = (
+ "The QuerySet value for the 'in' lookup must have 2 selected "
+ "fields (received 3)"
+ )
+ with self.assertRaisesMessage(ValueError, msg):
+ Comment.objects.filter(pk__in=Comment.objects.values("pk", "text"))
+
def test_filter_by_pk_in_none(self):
with self.assertNumQueries(0):
self.assertSequenceEqual(