mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #32169 -- Added distinct support to JSONBAgg.
This commit is contained in:
committed by
Mariusz Felisiak
parent
c36075ac1d
commit
18c8ced81e
@@ -428,6 +428,18 @@ class TestAggregateDistinct(PostgreSQLTestCase):
|
||||
values = AggregateTestModel.objects.aggregate(arrayagg=ArrayAgg('char_field', distinct=True))
|
||||
self.assertEqual(sorted(values['arrayagg']), ['Bar', 'Foo'])
|
||||
|
||||
def test_json_agg_distinct_false(self):
|
||||
values = AggregateTestModel.objects.aggregate(
|
||||
jsonagg=JSONBAgg('char_field', distinct=False),
|
||||
)
|
||||
self.assertEqual(sorted(values['jsonagg']), ['Bar', 'Foo', 'Foo'])
|
||||
|
||||
def test_json_agg_distinct_true(self):
|
||||
values = AggregateTestModel.objects.aggregate(
|
||||
jsonagg=JSONBAgg('char_field', distinct=True),
|
||||
)
|
||||
self.assertEqual(sorted(values['jsonagg']), ['Bar', 'Foo'])
|
||||
|
||||
|
||||
class TestStatisticsAggregate(PostgreSQLTestCase):
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user