summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorAlexander Kerkum <alex.kerkum@waarneming.nl>2022-09-16 16:47:50 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-09-18 07:39:47 +0200
commit2d20386b41f30ffbd9bfcadd48877ebd8766c22a (patch)
tree76925cb1198565c07c9da988321a3be362905730 /tests/postgres_tests
parent0859093f7c240b9677c62cac3682fd8c2643fa97 (diff)
[4.1.x] Fixed #34016 -- Fixed QuerySet.values()/values_list() crash on ArrayAgg() and JSONBAgg().
Regression in e06dc4571ea9fd5723c8029959b95808be9f8812. Backport of f88fc72da4eb76f2d464edb4874ef6046f8a8658 from main
Diffstat (limited to 'tests/postgres_tests')
-rw-r--r--tests/postgres_tests/test_aggregates.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py
index c2f38e42b6..9cca121802 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -686,6 +686,15 @@ class TestGeneralAggregate(PostgreSQLTestCase):
],
)
+ def test_values_list(self):
+ tests = [ArrayAgg("integer_field"), JSONBAgg("integer_field")]
+ for aggregation in tests:
+ with self.subTest(aggregation=aggregation):
+ self.assertCountEqual(
+ AggregateTestModel.objects.values_list(aggregation),
+ [([0],), ([1],), ([2],), ([0],)],
+ )
+
class TestAggregateDistinct(PostgreSQLTestCase):
@classmethod