diff options
| author | Simone Pellizzari <simone6021@libero.it> | 2019-04-06 13:45:22 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-04-06 15:15:40 +0200 |
| commit | 268ed9cd8adfda0eb789a9f6c58c91684b4567d9 (patch) | |
| tree | f492ae103ec503986a1e5c9d4362871452be70b0 /tests/postgres_tests | |
| parent | 9da25fb832ae9db1a26f3796dcc9df2546d04f2f (diff) | |
[2.2.x] Fixed #30332 -- Fixed crash of ordering by expressions with params in ArrayAgg and StringAgg.
Backport of d0315584b5ed6a47b486e65f6c88f80189f337ef from master.
Diffstat (limited to 'tests/postgres_tests')
| -rw-r--r-- | tests/postgres_tests/test_aggregates.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_aggregates.py b/tests/postgres_tests/test_aggregates.py index 85d6f45fd1..3622f6eff1 100644 --- a/tests/postgres_tests/test_aggregates.py +++ b/tests/postgres_tests/test_aggregates.py @@ -1,6 +1,7 @@ import json from django.db.models.expressions import F, Value +from django.db.models.functions import Concat, Substr from django.test.testcases import skipUnlessDBFeature from django.test.utils import Approximate @@ -38,6 +39,12 @@ class TestGeneralAggregate(PostgreSQLTestCase): ((F('boolean_field'), F('char_field').desc()), ['Foo4', 'Foo2', 'Foo3', 'Foo1']), ('char_field', ['Foo1', 'Foo2', 'Foo3', 'Foo4']), ('-char_field', ['Foo4', 'Foo3', 'Foo2', 'Foo1']), + (Concat('char_field', Value('@')), ['Foo1', 'Foo2', 'Foo3', 'Foo4']), + (Concat('char_field', Value('@')).desc(), ['Foo4', 'Foo3', 'Foo2', 'Foo1']), + ( + (Substr('char_field', 1, 1), F('integer_field'), Substr('char_field', 4, 1).desc()), + ['Foo3', 'Foo1', 'Foo2', 'Foo4'], + ), ) for ordering, expected_output in ordering_test_cases: with self.subTest(ordering=ordering, expected_output=expected_output): @@ -165,6 +172,8 @@ class TestGeneralAggregate(PostgreSQLTestCase): (F('char_field').desc(), 'Foo4;Foo3;Foo2;Foo1'), (F('char_field').asc(), 'Foo1;Foo2;Foo3;Foo4'), (F('char_field'), 'Foo1;Foo2;Foo3;Foo4'), + (Concat('char_field', Value('@')), 'Foo1;Foo2;Foo3;Foo4'), + (Concat('char_field', Value('@')).desc(), 'Foo4;Foo3;Foo2;Foo1'), ) for ordering, expected_output in ordering_test_cases: with self.subTest(ordering=ordering, expected_output=expected_output): |
