summaryrefslogtreecommitdiff
path: root/django/db/models/sql/compiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/compiler.py')
-rw-r--r--django/db/models/sql/compiler.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
index b0e3e48c15..c70dd8c5bd 100644
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -583,10 +583,11 @@ class SQLCompiler(object):
for annotation in self.query.annotation_select.values():
cols = annotation.get_group_by_cols()
for col in cols:
- sql = '%s.%s' % (qn(col[0]), qn(col[1]))
- if sql not in seen:
+ sql, col_params = self.compile(col)
+ if sql not in seen or col_params:
result.append(sql)
seen.add(sql)
+ params.extend(col_params)
return result, params