Opened 16 years ago

Closed 16 years ago

#7036 closed (fixed)

Oracle backend broken on queryset-refactor

Reported by: Malcolm Tredinnick Owned by: nobody
Component: Database layer (models, ORM) Version: queryset-refactor
Severity: Keywords: qs-rf
Cc: Erin Kelly Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Noting this here in case anybody is trying to use queryset-refactor and Oracle...

At some point in the recent past, I've managed to completely break Oracle backend. Ian Kelly reports a whole bunch of failures when running the test suite that look like

 File "/home/ikelly/projects/django.qs-rf/django/db/models/query.py",
line 156, in iterator
   obj = self.model(*row[index_start:])
 File "/home/ikelly/projects/django.qs-rf/django/db/models/base.py",
line 205, in __init__
   raise IndexError("Number of args exceeds number of fields")
IndexError: Number of args exceeds number of fields

My guess is that the resolve_columns() method in django.db.backend.oracle.query.OracleQuery needs updating in light of the changes in [7340] (which moved the "extra" select columns to the front of the output columns list), but that's just a guess.

Attachments (2)

oracle_resolve_columns_fix.patch (1.2 KB ) - added by jbronn 16 years ago.
Fix for OracleQuery.resolve_columns due to changes in #7340.
7036_redux.diff (2.0 KB ) - added by Erin Kelly 16 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 by Malcolm Tredinnick, 16 years ago

Triage Stage: UnreviewedAccepted

by jbronn, 16 years ago

Fix for OracleQuery.resolve_columns due to changes in #7340.

comment:2 by Alex Gaynor, 16 years ago

Has patch: set

comment:3 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: newclosed

(In [7438]) queryset-refactor: Fixed db column to model field mapping for Oracle backend.
Thanks, Justin Bronn. Fixed #7036.

comment:4 by Erin Kelly, 16 years ago

Keywords: qs-rf added
Resolution: fixed
Status: closedreopened

I'm reopening this because it's not a complete fix. The patch fixes the immediate problem, but it also removes all extra_select columns from the result set returned by Oracle, which causes queries that use extra_select to go haywire.

Just putting the extra_select columns back into the returned row causes the original error to occur again, and it turns out that the reason for this is that OracleQuery.as_sql is adding the 'rn' column to the extra_select after the QuerySet.iterator method has polled it to determine the number of extra_select columns. So OracleQuery.as_sql should not be adding anything to extra_select, period. The new patch fixes this by adding a row number placeholder to extra_select at the time Query.set_limits is called.

by Erin Kelly, 16 years ago

Attachment: 7036_redux.diff added

comment:5 by Erin Kelly, 16 years ago

Cc: Erin Kelly added

comment:6 by Malcolm Tredinnick, 16 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in [7443]. Thanks, Ian.

Note: See TracTickets for help on using tickets.
Back to Top