mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #32690 -- Fixed __in lookup crash when combining with filtered aggregates.
Having lookups group by subquery right-hand-sides is likely unnecessary
in the first place but relatively large amount of work would be needed
to achieve that such as making Lookup instances proper resolvable
expressions.
Regression in 3543129822.
Thanks James A. Munsch for the report.
This commit is contained in:
committed by
Mariusz Felisiak
parent
06fd4df41a
commit
136ff592ad
@@ -1525,6 +1525,14 @@ class AggregationTests(TestCase):
|
||||
allow_distinct = True
|
||||
DistinctAggregate('foo', distinct=True)
|
||||
|
||||
@skipUnlessDBFeature('supports_subqueries_in_group_by')
|
||||
def test_having_subquery_select(self):
|
||||
authors = Author.objects.filter(pk=self.a1.pk)
|
||||
books = Book.objects.annotate(Count('authors')).filter(
|
||||
Q(authors__in=authors) | Q(authors__count__gt=2)
|
||||
)
|
||||
self.assertEqual(set(books), {self.b1, self.b4})
|
||||
|
||||
|
||||
class JoinPromotionTests(TestCase):
|
||||
def test_ticket_21150(self):
|
||||
|
||||
Reference in New Issue
Block a user