1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35042 -- Fixed a count() crash on combined queries.

Regression in 59bea9efd2.

Thanks Marcin for the report.
This commit is contained in:
Simon Charette
2023-12-15 21:00:59 -05:00
committed by Mariusz Felisiak
parent eea4f92f9a
commit 77278929c8
2 changed files with 18 additions and 3 deletions

View File

@@ -520,11 +520,11 @@ class Query(BaseExpression):
self.model._meta.pk.get_col(inner_query.get_initial_alias()),
)
inner_query.default_cols = False
if not qualify:
if not qualify and not self.combinator:
# Mask existing annotations that are not referenced by
# aggregates to be pushed to the outer query unless
# filtering against window functions is involved as it
# requires complex realising.
# filtering against window functions or if the query is
# combined as both would require complex realiasing logic.
annotation_mask = set()
if isinstance(self.group_by, tuple):
for expr in self.group_by: