Django

Code

Ticket #7036 (closed: fixed)

Opened 5 months ago

Last modified 4 months ago

Oracle backend broken on queryset-refactor

Reported by: mtredinnick Assigned to: nobody
Milestone: Component: Database wrapper
Version: queryset-refactor Keywords: qs-rf
Cc: ikelly Triage Stage: Accepted
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

oracle_resolve_columns_fix.patch (1.2 kB) - added by jbronn on 04/19/08 23:23:56.
Fix for OracleQuery?.resolve_columns due to changes in #7340.
7036_redux.diff (2.0 kB) - added by ikelly on 04/21/08 18:32:44.

Change History

04/18/08 08:35:52 changed by mtredinnick

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • needs_docs changed.

04/19/08 23:23:56 changed by jbronn

  • attachment oracle_resolve_columns_fix.patch added.

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

04/19/08 23:58:33 changed by Alex

  • has_patch set to 1.

04/20/08 03:47:43 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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

04/21/08 18:31:50 changed by ikelly

  • keywords set to qs-rf.
  • status changed from closed to reopened.
  • resolution deleted.

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.

04/21/08 18:32:44 changed by ikelly

  • attachment 7036_redux.diff added.

04/21/08 18:36:16 changed by ikelly

  • cc set to ikelly.

04/23/08 02:32:15 changed by mtredinnick

  • status changed from reopened to closed.
  • resolution set to fixed.

Fixed in [7443]. Thanks, Ian.


Add/Change #7036 (Oracle backend broken on queryset-refactor)




Change Properties
Action