summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorArtur Beltsov <artur1998g@gmail.com>2020-11-04 16:30:47 +0500
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-04 21:22:54 +0100
commit18c8ced81e4a6e093c732f8cded3b16426d16952 (patch)
tree8e46d2a055bc61bc80ee20c5c9afbc6b4bfd43e5 /tests/postgres_tests
parentc36075ac1dddfa986340b1a5e15fe48833322372 (diff)
Fixed #32169 -- Added distinct support to JSONBAgg.
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_aggregates.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index 06cca6313d..064536a2c6 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -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