diff options
| author | Simon Charette <charette.s@gmail.com> | 2025-04-02 23:20:53 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-04-03 17:51:26 +0200 |
| commit | 543e17c4405dfdac4f18759fc78b190406d14239 (patch) | |
| tree | 8b0080a3b22b05bed463d7ba88a17e488e8e3e5a /django/db/models/sql/query.py | |
| parent | 3ae049b26b995c650c41ef918d5f60beed52b4ba (diff) | |
Fixed #36292 -- Fixed crash when aggregating over a group mixing transforms and references.
Regression in 65ad4ade74dc9208b9d686a451cd6045df0c9c3a.
Refs #28900
Thanks Patrick Altman for the report.
Diffstat (limited to 'django/db/models/sql/query.py')
| -rw-r--r-- | django/db/models/sql/query.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py index 0d1fe5fb43..9fde8496e9 100644 --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -2339,6 +2339,9 @@ class Query(BaseExpression): self.append_annotation_mask(group_by_annotations) self.select = tuple(values_select.values()) self.values_select = tuple(values_select) + if self.selected is not None: + for index, value_select in enumerate(values_select): + self.selected[value_select] = index group_by = list(self.select) for alias, annotation in self.annotation_select.items(): if not (group_by_cols := annotation.get_group_by_cols()): |
