Commit 84909377 authored by Anssi Kääriäinen's avatar Anssi Kääriäinen
Browse files

Fixed #18785 -- Added Test join trimming regression

The regression was caused by patch to ticket #15316 and was fixed by a
patch to #10790.
parent fa7cb4ef
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2852,3 +2852,14 @@ class DoubleInSubqueryTests(TestCase):
        qs = LeafB.objects.filter(pk__in=joins)
        self.assertQuerysetEqual(
            qs, [lfb1], lambda x: x)

class Ticket18785Tests(unittest.TestCase):
    def test_ticket_18785(self):
        # Test join trimming from ticket18785
        qs = Item.objects.exclude(
            note__isnull=False
        ).filter(
            name='something', creator__extra__isnull=True
        ).order_by()
        self.assertEquals(1, str(qs.query).count('INNER JOIN'))
        self.assertEquals(0, str(qs.query).count('OUTER JOIN'))