1
0
mirror of https://github.com/django/django.git synced 2025-10-27 15:46:10 +00:00

[5.2.x] Fixed #36405 -- Fixed OrderableAggMixin.order_by using OuterRef.

co-authored-by: Simon Charette <charette.s@gmail.com>

Backport of c2615a0500 from main.
This commit is contained in:
Adam Johnson
2025-05-21 14:48:59 +02:00
committed by Sarah Boyce
parent c29e3092fd
commit 7e4b371eb0
3 changed files with 16 additions and 5 deletions

View File

@@ -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")