'Regression test for #8039: Ordering sometimes removed relevant tables
from extra(). This test is the critical case: ordering uses a table,
but then removes the reference because of an optimisation. The table
should still be present because of the extra() call.'

def test_regression_8039(self):

    self.assertQuerysetEqual(Order.objects.extra(where=[u'username=%s'], params=[u'fred'], tables=[u'auth_user']).order_by(u'created_by'), [])
