'Extra WHERE clauses get correctly ANDed, even when they
contain OR operations.'

def test_regression_17877(self):

    t = TestObject(first='a', second='a', third='a')
    t.save()
    t = TestObject(first='b', second='a', third='a')
    t.save()
    t = TestObject(first='a', second='a', third='b')
    t.save()
    t = TestObject(first='b', second='a', third='b')
    t.save()
    t = TestObject(first='b', second='b', third='a')
    t.save()
    t = TestObject(first='a', second='b', third='b')
    t.save()
    self.assertQuerysetEqual(TestObject.objects.extra(where=["first    =    'a'    OR    second    =    'a'", "third    =    'a'"]), ['<TestObject:    TestObject:    a,a,a>', '<TestObject:    TestObject:    b,a,a>'], ordered=False)
