summaryrefslogtreecommitdiff
path: root/django/db/models/sql/query.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/db/models/sql/query.py')
-rw-r--r--django/db/models/sql/query.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 9819be09a1..72d4bc9c1b 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -189,6 +189,11 @@ class Query(object):
raise ValueError("Need either using or connection")
if using:
connection = connections[using]
+
+ # Check that the compiler will be able to execute the query
+ for alias, aggregate in self.aggregate_select.items():
+ connection.ops.check_aggregate_support(aggregate)
+
return connection.ops.compiler(self.compiler)(self, connection, using)
def get_meta(self):