diff options
| author | Simon Charette <charette.s@gmail.com> | 2023-07-28 07:45:23 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-07-29 16:08:20 +0200 |
| commit | 4087367ba869be9cf305dac39a8887d4aa4041d2 (patch) | |
| tree | 1778dd9508794259a74adfca9bbcfc470d5e488f /tests/aggregation/tests.py | |
| parent | af0c5caff72e5ffda4dff708a57e37ae4778197d (diff) | |
Fixed #34748 -- Fixed queryset crash when grouping by a reference in a subquery.
Regression in dd68af62b2b27ece50d434f6a351877212e15c3f.
Thanks Toan Vuong for the report.
Diffstat (limited to 'tests/aggregation/tests.py')
| -rw-r--r-- | tests/aggregation/tests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py index db69246952..9f2a7c8841 100644 --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -2116,6 +2116,16 @@ class AggregateTestCase(TestCase): }, ) + def test_group_by_reference_subquery(self): + author_qs = ( + Author.objects.annotate(publisher_id=F("book__publisher")) + .values("publisher_id") + .annotate(cnt=Count("*")) + .values("publisher_id") + ) + qs = Publisher.objects.filter(pk__in=author_qs) + self.assertCountEqual(qs, [self.p1, self.p2, self.p3, self.p4]) + class AggregateAnnotationPruningTests(TestCase): @classmethod |
