summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index a7bc0610c8..07c3fdbd34 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -565,8 +565,7 @@ class Query(BaseExpression):
col_alias = f"__col{index}"
col_ref = Ref(col_alias, col)
col_refs[col] = col_ref
- inner_query.annotations[col_alias] = col
- inner_query.append_annotation_mask([col_alias])
+ inner_query.add_annotation(col, col_alias)
replacements[col] = col_ref
outer_query.annotations[alias] = aggregate.replace_expressions(
replacements