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:
Simon Charette 2019-02-27 00:48:41 -05:00 committed by Tim Graham
parent 9dc367dc10
commit fb3f034f1c
2 changed files with 52 additions and 1 deletions

View file

@ -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)'