summaryrefslogtreecommitdiff
path: root/tests/postgres_tests
diff options
context:
space:
mode:
authorAdam Johnson <me@adamj.eu>2025-05-21 13:48:59 +0100
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2025-05-23 16:15:59 +0200
commitc2615a050036eda0bca090c707191076220cee9f (patch)
treeaeeefc43af5b18d29b4073a16470af2cd7713ce0 /tests/postgres_tests
parentb8e5a8a9a2a767f584cbe89a878a42363706f939 (diff)
Fixed #36405 -- Fixed Aggregate.order_by using OuterRef.
co-authored-by: Simon Charette <charette.s@gmail.com>
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 ae386b6659..621fa43d91 100644
--- a/tests/postgres_tests/test_aggregates.py
+++ b/tests/postgres_tests/test_aggregates.py
@@ -364,6 +364,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")