mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #25377 -- Changed Count queries to execute COUNT(*) instead of COUNT('*').
This commit is contained in:
parent
4d933ad418
commit
3fe3887a2e
6 changed files with 33 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue