summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-01-27 23:10:13 -0500
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-02-11 09:08:35 +0100
commit41239fe34d64e801212dccaa4585e4802d0fac68 (patch)
tree5a7375f6945d53932f682fa894dd856d22129327 /django/db/models/sql/query.py
parent0597e8ad1e55b565292ead732916aa0e39bdf37b (diff)
Fixed #36149 -- Allowed subquery values against tuple exact and in lookups.
Non-tuple exact and in lookups have specialized logic for subqueries that can be adapted to properly assign select mask if unspecified and ensure the number of involved members are matching on both side of the operator.
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index ec47d9aa24..0d1fe5fb43 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1224,6 +1224,12 @@ class Query(BaseExpression):
if self.selected:
self.selected[alias] = alias
+ @property
+ def _subquery_fields_len(self):
+ if self.has_select_fields:
+ return len(self.selected)
+ return len(self.model._meta.pk_fields)
+
def resolve_expression(self, query, *args, **kwargs):
clone = self.clone()
# Subqueries need to use a different set of aliases than the outer query.