mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +00:00
Fixed #32169 -- Added distinct support to JSONBAgg.
This commit is contained in:
parent
c36075ac1d
commit
18c8ced81e
4 changed files with 25 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue