'Regression for #10847: the list of extra columns can always be
accurately evaluated. Using an inner query ensures that as_sql() is
producing correct output without requiring full evaluation and
execution of the inner query.'

def test_regression_10847(self):

    obj = TestObject(first='first', second='second', third='third')
    obj.save()
    self.assertEqual(list(TestObject.objects.extra(select={'extra': 1}).values('pk')), [{'pk': obj.pk}])
    self.assertQuerysetEqual(TestObject.objects.filter(pk__in=TestObject.objects.extra(select={'extra': 1}).values('pk')), ['<TestObject:    TestObject:    first,second,third>'])
    self.assertEqual(list(TestObject.objects.values('pk').extra(select={'extra': 1})), [{'pk': obj.pk}])
    self.assertQuerysetEqual(TestObject.objects.filter(pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})), ['<TestObject:    TestObject:    first,second,third>'])
    self.assertQuerysetEqual((TestObject.objects.filter(pk=obj.pk) | TestObject.objects.extra(where=['id    >    %s'], params=[obj.pk])), ['<TestObject:    TestObject:    first,second,third>'])
