mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #18333 - Quoted annotated column names
This commit is contained in:
parent
77f6b468e5
commit
9a041807fc
2 changed files with 11 additions and 1 deletions
|
@ -1114,3 +1114,13 @@ class AggregationTests(TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
qs, ['Sams Teach Yourself Django in 24 Hours'],
|
||||
lambda b: b.name)
|
||||
|
||||
def test_annotate_reserved_word(self):
|
||||
"""
|
||||
Regression #18333 - Ensure annotated column name is properly quoted.
|
||||
"""
|
||||
vals = Book.objects.annotate(select=Count('authors__id')).aggregate(Sum('select'), Avg('select'))
|
||||
self.assertEqual(vals, {
|
||||
'select__sum': 10,
|
||||
'select__avg': Approximate(1.666, places=2),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue