From 84909377f2f2eea07ab8bf398dafc69e2d736b50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anssi=20K=C3=A4=C3=A4ri=C3=A4inen?= Date: Sat, 1 Jun 2013 00:26:16 +0300 Subject: [PATCH] Fixed #18785 -- Added Test join trimming regression The regression was caused by patch to ticket #15316 and was fixed by a patch to #10790. --- tests/queries/tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/queries/tests.py b/tests/queries/tests.py index d28291f340..8d1b19f169 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -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'))