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:08 +0200 |
| commit | 4ccca9eedc2f453602a20f562399a835a24817c1 (patch) | |
| tree | c904751d7739cd3fbcd762d56c1f7c97b455d8d2 /django/db/models/sql | |
| parent | 12a19321b4b8abec05e27af8c5931d2ff836bbec (diff) | |
[5.0.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')
| -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 a7839ccb4d..4690fd304d 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -452,7 +452,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( |
