'Columns are aligned in the correct order for resolve_columns. This test
will fail on MySQL if column ordering is out. Column fields should be
aligned as:
1. extra_select
2. model_fields
3. annotation_fields
4. model_related_fields'

def test_column_field_ordering(self):

    store = Store.objects.first()
    Employee.objects.create(id=1, first_name='Max', manager=True, last_name='Paine', store=store, age=23, salary=Decimal(50000.0))
    Employee.objects.create(id=2, first_name='Buffy', manager=False, last_name='Summers', store=store, age=18, salary=Decimal(40000.0))
    qs = Employee.objects.extra(select={'random_value': '42'}).select_related('store').annotate(annotated_value=Value(17, output_field=IntegerField()))
    rows = [(1, 'Max', True, 42, 'Paine', 23, Decimal(50000.0), store.name, 17), (2, 'Buffy', False, 42, 'Summers', 18, Decimal(40000.0), store.name, 17)]
    self.assertQuerysetEqual(qs.order_by('id'), rows, (lambda e: (e.id, e.first_name, e.manager, e.random_value, e.last_name, e.age, e.salary, e.store.name, e.annotated_value)))
