summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2025-05-21 14:48:59 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-05-23 16:23:34 +0200
commit7e4b371eb070d892e9c27eacbe140c78b7d34059 (patch)
treeb5e58e902d75f2a09ed8a9adceb0e0dd4c115f53 /tests/postgres_tests
parentc29e3092fdb1136f0945ce2be8f14c3853d6c8da (diff)
[5.2.x] Fixed #36405 -- Fixed OrderableAggMixin.order_by using OuterRef.
co-authored-by: Simon Charette <charette.s@gmail.com> Backport of c2615a050036eda0bca090c707191076220cee9f from main.
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 ddd3b6bbd0..0037fb9f83 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -350,6 +350,18 @@ class TestGeneralAggregate(PostgreSQLTestCase):
[[], [], [], []],
)
+ def test_array_agg_with_order_by_outer_ref(self):
+ StatTestModel.objects.annotate(
+ atm_ids=Subquery(
+ AggregateTestModel.objects.annotate(
+ ids=ArrayAgg(
+ "id",
+ order_by=[OuterRef("int1")],
+ )
+ ).values("ids")[:1]
+ )
+ )
+
def test_bit_and_general(self):
values = AggregateTestModel.objects.filter(integer_field__in=[0, 1]).aggregate(
bitand=BitAnd("integer_field")