summaryrefslogtreecommitdiff
path: root/tests/aggregation
diff options
context:
space:
mode:
Diffstat (limited to 'tests/aggregation')
-rw-r--r--tests/aggregation/tests.py15
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)