diff options
| author | Simon Charette <charette.s@gmail.com> | 2019-02-27 00:48:41 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2019-03-21 18:48:41 -0400 |
| commit | fb3f034f1c63160c0ff13c609acd01c18be12f80 (patch) | |
| tree | ea5948f50d2494abedf739a71f62246bb5f9d4ec /django | |
| parent | 9dc367dc10594ad024c83d398a8e3c3f8f221446 (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/models/expressions.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index 30c2f465f0..cb50f73f1d 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -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)' |
