diff options
| author | Adam Chainz <adam@adamj.eu> | 2015-09-10 17:07:09 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-14 14:07:32 -0400 |
| commit | 3c2c74f58f9261feaa5ad9dfb596213a654c2e25 (patch) | |
| tree | 214f85dc22ca5f5dbb6c2be965111e6e4f38ea44 /tests/aggregation | |
| parent | 69017bade0bcce0671e7d64c5a78626efa82a4ff (diff) | |
[1.8.x] Fixed #25377 -- Changed Count queries to execute COUNT(*) instead of COUNT('*').
Backport of 3fe3887a2ed94f7b15be769f6d81571031ec5627 from master
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index 384013ef2f..d9404ccfca 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -306,6 +306,12 @@ class BaseAggregateTestCase(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_fkey_aggregate(self): explicit = list(Author.objects.annotate(Count('book__id'))) implicit = list(Author.objects.annotate(Count('book'))) |
