diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-11-23 00:09:08 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-11-23 06:09:58 +0100 |
| commit | 95dec210e89a2fb46ffde2ba29ff7876e1d5f86e (patch) | |
| tree | 1cf40bd163c530ca8e165105c697ece35a21ae83 /docs | |
| parent | 06bdf62b56a7cbd37a74b590587a8ae51b206321 (diff) | |
[5.0.x] Fixed #34987 -- Fixed queryset crash when mixing aggregate and window annotations.
Regression in f387d024fc75569d2a4a338bfda76cc2f328f627.
Just like `OrderByList` the `ExpressionList` expression used to wrap
`Window.partition_by` must implement `get_group_by_cols` to ensure the
necessary grouping when mixing window expressions with aggregate
annotations is performed against the partition members and not the
partition expression itself.
This is necessary because while `partition_by` is implemented as
a source expression of `Window` it's actually a fragment of the WINDOW
expression at the SQL level and thus it should result in a group by its
members and not the sum of them.
Thanks ElRoberto538 for the report.
Backport of e76cc93b0168fa3abbafb9af1ab4535814b751f0 from main
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/4.2.8.txt | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/releases/4.2.8.txt b/docs/releases/4.2.8.txt index 5c2d089b7f..f155e309c3 100644 --- a/docs/releases/4.2.8.txt +++ b/docs/releases/4.2.8.txt @@ -16,3 +16,7 @@ Bugfixes * Fixed a regression in Django 4.2 that caused a crash of ``QuerySet.aggregate()`` with aggregates referencing other aggregates or window functions through conditional expressions (:ticket:`34975`). + +* Fixed a regression in Django 4.2 that caused a crash when annotating a + ``QuerySet`` with a ``Window`` expressions composed of a ``partition_by`` + clause mixing field types and aggregation expressions (:ticket:`34987`). |
