                          # If the field was deferred, exclude it from being passed
                          # into `resolve_columns` because it wasn't selected.
                          only_load = self.deferred_to_columns()
                          if only_load:
                              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]]
                          if has_aggregate_select:
                              # pad None in to fields for aggregates
                              fields = fields[:aggregate_start] + [
                                  None for x in range(0, aggregate_end - aggregate_start)
                              ] + fields[aggregate_start:]
 
</s> remove     CategoryRelationship)
 </s> add     CategoryRelationship, Ticket21203Parent, Ticket21203Child)
                            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]]
                          # If the field was deferred, exclude it from being passed
                          # into `resolve_columns` because it wasn't selected.
                          only_load = self.deferred_to_columns()
                          if only_load:
                            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]]
                            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]]
                            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]]
                          if has_aggregate_select:
                              # pad None in to fields for aggregates
                              fields = fields[:aggregate_start] + [
                                  None for x in range(0, aggregate_end - aggregate_start)
                              ] + fields[aggregate_start:]
keep keep keep keep replace replace replace keep keep keep keep keep
 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(). 
django/db/models/sql/compiler.py