summaryrefslogtreecommitdiff
path: root/tests/aggregation
diff options
context:
space:
mode:
authorAdam Chainz <adam@adamj.eu>2015-09-10 17:07:09 +0100
committerTim Graham <timograham@gmail.com>2015-09-14 13:41:35 -0400
commit3fe3887a2ed94f7b15be769f6d81571031ec5627 (patch)
treeaa2b8fa24b4d20fd0782cdf58a04a353d956be2b /tests/aggregation
parent4d933ad4181a511f3ced98edba4e17aff054e0e2 (diff)
Fixed #25377 -- Changed Count queries to execute COUNT(*) instead of COUNT('*').
Diffstat (limited to 'tests/aggregation')
-rw-r--r--tests/aggregation/tests.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index 1472bd04fd..a1d12e363e 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -405,6 +405,12 @@ class AggregateTestCase(TestCase):
vals = Book.objects.aggregate(Count("rating", distinct=True))
self.assertEqual(vals, {"rating__count": 4})
+ def test_count_star(self):
+ with self.assertNumQueries(1) as ctx:
+ Book.objects.aggregate(n=Count("*"))
+ sql = ctx.captured_queries[0]['sql']
+ self.assertIn('SELECT COUNT(*) ', sql)
+
def test_non_grouped_annotation_not_in_group_by(self):
"""
An annotation not included in values() before an aggregate should be