diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-11-17 19:42:44 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-11-18 15:38:04 +0100 |
| commit | 7530cf3900ab98104edcde69e8a2a415e82b345a (patch) | |
| tree | b0b2d30e5f1849be26aa6203453907a17f498111 /tests/aggregation | |
| parent | 594873befbbec13a2d9a048a361757dd3cf178da (diff) | |
Fixed #34975 -- Fixed crash of conditional aggregate() over aggregations.
Adjustments made to solve_lookup_type to defer the resolving of
references for summarized aggregates failed to account for similar
requirements for lookup values which can also reference annotations
through Aggregate.filter.
Regression in b181cae2e3697b2e53b5b67ac67e59f3b05a6f0d.
Refs #25307.
Thanks Sergey Nesterenko for the report.
Diffstat (limited to 'tests/aggregation')
| -rw-r--r-- | tests/aggregation/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index a073d01590..af6c660cf1 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -2309,3 +2309,9 @@ class AggregateAnnotationPruningTests(TestCase): aggregate, {"sum_avg_publisher_pages": 1100.0, "books_count": 2}, ) + + def test_aggregate_reference_lookup_rhs(self): + aggregates = Author.objects.annotate( + max_book_author=Max("book__authors"), + ).aggregate(count=Count("id", filter=Q(id=F("max_book_author")))) + self.assertEqual(aggregates, {"count": 1}) |
