diff options
| author | Hannes Ljungberg <hannes.ljungberg@gmail.com> | 2020-10-19 22:36:24 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-10-21 07:22:52 +0200 |
| commit | 0e7a45fca09623e7bad9408a838e522b3cca8d65 (patch) | |
| tree | e621fc32ee804f72852fe8f39434201fbf9f861f /django | |
| parent | 4343430e9c83d1f139e6fbae3a1332f980d5d4fa (diff) | |
Fixed #32126 -- Fixed grouping by Case() annotation without cases.
Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
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 43b8920d95..13918467ee 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -1068,6 +1068,11 @@ class Case(Expression): sql = connection.ops.unification_cast_sql(self.output_field) % sql return sql, sql_params + def get_group_by_cols(self, alias=None): + if not self.cases: + return self.default.get_group_by_cols(alias) + return super().get_group_by_cols(alias) + class Subquery(Expression): """ |
