diff -ruN django.branch/db/backends/oracle/query.py django/db/backends/oracle/query.py
old
|
new
|
|
23 | 23 | Helper function that recursively populates the select, tables and where (in |
24 | 24 | place) for select_related queries. |
25 | 25 | """ |
26 | | from django.db.models.fields import AutoField |
27 | 26 | qn = backend.quote_name |
28 | 27 | for f in opts.fields: |
29 | 28 | if f.rel and not f.null: |
… |
… |
|
37 | 36 | cache_tables_seen.append(db_table) |
38 | 37 | where.append('%s.%s = %s.%s' % \ |
39 | 38 | (qn(old_prefix), qn(f.column), qn(db_table), qn(f.rel.get_related_field().column))) |
40 | | select.extend(['%s.%s' % (backend.quote_name(db_table), backend.quote_name(f2.column)) for f2 in f.rel.to._meta.fields if not isinstance(f2, AutoField)]) |
| 39 | select.extend(['%s.%s' % (backend.quote_name(db_table), backend.quote_name(f2.column)) for f2 in f.rel.to._meta.fields]) |
41 | 40 | fill_table_cache(f.rel.to._meta, select, tables, where, db_table, cache_tables_seen) |
42 | 41 | |
43 | 42 | |
… |
… |
|
168 | 167 | |
169 | 168 | # LIMIT and OFFSET clauses |
170 | 169 | # To support limits and offsets, Oracle requires some funky rewriting of an otherwise normal looking query. |
171 | | select_clause = ",".join(select) |
| 170 | select_clause = ",".join(["%s as COLUMN#%s"%(select[i], i) for i in xrange(len(select))]) |
172 | 171 | distinct = (self._distinct and "DISTINCT " or "") |
173 | 172 | |
174 | 173 | if order_by: |