#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'"])
Note:
See TracTickets
for help on using tickets.
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