diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-12-15 21:00:59 -0500 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-12-16 20:19:24 +0100 |
| commit | 77278929c86168f075600d9d8c8e76a4792e672b (patch) | |
| tree | 62c5808bac7712ec85d4d99958dd3788e9e54c56 /tests/aggregation/tests.py | |
| parent | eea4f92f9aa57d1b25f1c28d11c3b5a6a5841e82 (diff) | |
Fixed #35042 -- Fixed a count() crash on combined queries.
Regression in 59bea9efd2768102fc9d3aedda469502c218e9b7.
Thanks Marcin for the report.
Diffstat (limited to 'tests/aggregation/tests.py')
| -rw-r--r-- | tests/aggregation/tests.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index 62e9c6a27a..4408535228 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -2344,3 +2344,18 @@ class AggregateAnnotationPruningTests(TestCase): max_book_author=Max("book__authors"), ).aggregate(count=Count("id", filter=Q(id__in=[F("max_book_author"), 0]))) self.assertEqual(aggregates, {"count": 1}) + + def test_aggregate_combined_queries(self): + # Combined queries could have members in their values select mask while + # others have them in their annotation mask which makes annotation + # pruning complex to implement hence why it's not implemented. + qs = Author.objects.values( + "age", + other=Value(0), + ).union( + Book.objects.values( + age=Value(0), + other=Value(0), + ) + ) + self.assertEqual(qs.count(), 3) |
