mirror of
https://github.com/django/django.git
synced 2025-08-31 07:47:37 +00:00
Fixed #30158 -- Avoided unnecessary subquery group by on aggregation.
Subquery annotations can be omitted from the GROUP BY clause on aggregation as long as they are not explicitly grouped against. Thanks Jonny Fuller for the report.
This commit is contained in:
parent
9dc367dc10
commit
fb3f034f1c
2 changed files with 52 additions and 1 deletions
|
@ -1082,6 +1082,11 @@ class Subquery(Expression):
|
|||
return clone
|
||||
return self
|
||||
|
||||
def get_group_by_cols(self, alias=None):
|
||||
if alias:
|
||||
return [Ref(alias, self)]
|
||||
return []
|
||||
|
||||
|
||||
class Exists(Subquery):
|
||||
template = 'EXISTS(%(subquery)s)'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue