summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Charette <charette.s@gmail.com>2025-11-24 06:14:38 -0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-11-24 12:15:48 +0100
commit1e7327770c908cb51f888c9269322247fa3525a5 (patch)
tree67fadecb76f101546c547f60e37965894a1c6383 /docs
parent338912e84e2853e2da5c9ca6dae9d94445a59236 (diff)
[5.2.x] Fixed #36751 -- Fixed empty filtered aggregation crash over annotated queryset.
Regression in b8e5a8a9a2a767f584cbe89a878a42363706f939. Refs #36404. The replace_expressions method was innapropriately dealing with falsey but not None source expressions causing them to also be potentially evaluated when __bool__ was invoked (e.g. QuerySet.__bool__ evaluates the queryset). The changes introduced in b8e5a8a9a2, which were to deal with a similar issue, surfaced the problem as aggregation over an annotated queryset requires an inlining (or pushdown) of aggregate references which is achieved through replace_expressions. In cases where an empty Q object was provided as an aggregate filter, such as when the admin facetting feature was used as reported, it would wrongly be turned into None, instead of an empty WhereNode, causing a crash at aggregate filter compilation. Note that the crash signature differed depending on whether or not the backend natively supports aggregate filtering (supports_aggregate_filter_clause) as the fallback, which makes use Case / When expressions, would result in a TypeError instead of a NoneType AttributeError. Thanks Rafael Urben for the report, Antoliny and Youngkwang Yang for the triage. Backport of 2a6e0bd72d4a69725b957d6748a4b834f21b12b5 from main
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/5.2.9.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/releases/5.2.9.txt b/docs/releases/5.2.9.txt
index 588c278be5..515b233b8a 100644
--- a/docs/releases/5.2.9.txt
+++ b/docs/releases/5.2.9.txt
@@ -16,3 +16,7 @@ Bugfixes
* Fixed a bug in Django 5.2 on PostgreSQL where ``bulk_create()`` did not apply
a field's custom query placeholders (:ticket:`36748`).
+
+* Fixed a regression in Django 5.2.2 that caused a crash when using aggregate
+ functions with an empty ``Q`` filter over a queryset with annotations
+ (:ticket:`36751`).