'This routine is necessary so that distances and geometries returned
from extra selection SQL get resolved appropriately into Python
objects.'

def resolve_columns(self, row, fields=()):

    values = []
    aliases = self.query.extra_select.keys()
    if self.query.aggregates:
        aliases.extend([None for i in xrange(len(self.query.aggregates))])
    rn_offset = 0
    if self.connection.ops.oracle:
        if ((self.query.high_mark is not None) or self.query.low_mark):
            rn_offset = 1
    index_start = (rn_offset + len(aliases))
    values = [self.query.convert_values(v, self.query.extra_select_fields.get(a, None), self.connection) for (v, a) in izip(row[rn_offset:index_start], aliases)]
    if (self.connection.ops.oracle or getattr(self.query, 'geo_values', False)):
        for (value, field) in map(None, row[index_start:], fields):
            values.append(self.query.convert_values(value, field, connection=self.connection))
    else:
        values.extend(row[index_start:])
    return tuple(values)
