Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#13076 closed (invalid)

Oracle backend: Error ORA-01036 when using extra() with params

Reported by: aprilmay Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: Oracle extra
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The extra function on query_set give an error when using it with "params" (using Oracle 9i, cx_Oracle 5.0.2).

MyModel.objects.extra(where=["DESCRIPTION like '%s'"], params=["something"])

throws:

DatabaseError: ORA-01036: illegal variable name/number

Note: the following works

MyModel.objects.extra(where=["DESCRIPTION like 'something'"])

Change History (2)

comment:1 by Karen Tracey, 15 years ago

Resolution: invalid
Status: newclosed

Don't attempt to do your own quoting in the where clause when you are supplying parameters. That is, remove the quotes around '%s'; the backend will handle quoting and any escaping necessary for the parameters you pass. See: http://docs.djangoproject.com/en/dev/ref/models/querysets/#extra-select-none-where-none-params-none-tables-none-order-by-none-select-params-none

comment:2 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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