Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Nov 24, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

timgraham and others added 2 commits November 23, 2025 11:53
…null) feature flags.

Needed on MongoDB.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
… queryset.

Regression in b8e5a8a.

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 b8e5a8a, 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.
@pull pull bot locked and limited conversation to collaborators Nov 24, 2025
@pull pull bot added the ⤵️ pull label Nov 24, 2025
@pull pull bot merged commit 2a6e0bd into threatcode:main Nov 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants