diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-10-15 21:59:15 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-10-16 06:15:36 +0200 |
| commit | 803caec60bed3b282b9f9961860a467160c0c8f1 (patch) | |
| tree | 051ca6113da9dacd430babe0e7f28933b9dfe7d7 /django/db/models/sql/query.py | |
| parent | caec4f4a6fc0f0ba60e9d4e4e7f3bfb6f6d492a7 (diff) | |
[4.2.x] Fixed #34798 -- Fixed QuerySet.aggregate() crash when referencing expressions containing subqueries.
Regression in 59bea9efd2768102fc9d3aedda469502c218e9b7,
complements e5c844d6f2a4ac6ae674d741b5f1fa2a688cedf4.
Refs #28477, #34551.
Thanks Haldun Komsuoglu for the report.
Backport of 3b4a571275d967512866012955eb0b3ae486d63c from main
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 27f94175bb..0709c4a45f 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -404,7 +404,7 @@ class Query(BaseExpression): # members of `aggregates` to resolve against each others. self.append_annotation_mask([alias]) refs_subquery |= any( - getattr(self.annotations[ref], "subquery", False) + getattr(self.annotations[ref], "contains_subquery", False) for ref in aggregate.get_refs() ) refs_window |= any( |
