              self.assertEqual(task_select_related.creator.staffuser.staff,
                               task_get.creator.staffuser.staff)
              self.assertEqual(task_select_related.owner.staffuser.staff,
                               task_get.owner.staffuser.staff)
 
</s> remove     CategoryRelationship)
 </s> add     CategoryRelationship, Ticket21203Parent, Ticket21203Child) </s> remove                             db_table = self.query.get_meta().db_table
                            fields = [f for f in fields if db_table in only_load and
                                      f.column in only_load[db_table]]
 </s> add                             fields = [f for f in fields if f.model._meta.db_table not in only_load or
                                      f.column in only_load[f.model._meta.db_table]]
class Ticket21203Tests(TestCase):
    def test_ticket_21203(self):
        p = Ticket21203Parent.objects.create(parent_bool=True)
        c = Ticket21203Child.objects.create(parent=p)
        qs = Ticket21203Child.objects.select_related('parent').defer('parent__created')
        self.assertQuerysetEqual(qs, [c], lambda x: x)
        self.assertIs(qs[0].parent.parent_bool, True)
              self.assertEqual(task_select_related.creator.staffuser.staff,
                               task_get.creator.staffuser.staff)
              self.assertEqual(task_select_related.owner.staffuser.staff,
                               task_get.owner.staffuser.staff)
class Ticket21203Tests(TestCase):
    def test_ticket_21203(self):
        p = Ticket21203Parent.objects.create(parent_bool=True)
        c = Ticket21203Child.objects.create(parent=p)
        qs = Ticket21203Child.objects.select_related('parent').defer('parent__created')
        self.assertQuerysetEqual(qs, [c], lambda x: x)
        self.assertIs(qs[0].parent.parent_bool, True)
keep keep keep add
 Fixed #21203 -- resolve_columns fields misalignment

In queries using .defer() together with .select_related() the values
and fields arguments didn't align properly for resolve_columns(). 
tests/queries/tests.py