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