Opened 17 years ago
Last modified 17 years ago
#5558 closed
istartswith lookup fails with ORACLE in r6393 — at Version 4
Reported by: | Owned by: | Matt Boersma | |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | Oracle oracle db backend startswith istartswith | |
Cc: | ian.g.kelly@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
I have an Oracle9i database and access that from a PowerPC Mac using the latest cx_Oracle 4.3.1 and python 2.5.1
filtering a queryset with startswith or istartswith returns the following oracle error
(this seems to be model independent, and not related to my code)
In [27]: JobStatus.objects.filter(channel__name__istartswith="a") Out[27]: --------------------------------------------------------------------------- <class 'cx_Oracle.DatabaseError'> Traceback (most recent call last) /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/mcc/<ipython console> in <module>() /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/IPython/Prompts.py in __call__(self, arg) 521 522 # and now call a possibly user-defined print mechanism --> 523 manipulated_val = self.display(arg) 524 525 # user display hooks can change the variable to be stored in /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/IPython/Prompts.py in _display(self, arg) 545 """ 546 --> 547 return self.shell.hooks.result_display(arg) 548 549 # Assign the default display method: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/IPython/hooks.py in __call__(self, *args, **kw) 132 #print "prio",prio,"cmd",cmd #dbg 133 try: --> 134 ret = cmd(*args, **kw) 135 return ret 136 except ipapi.TryNext, exc: /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/IPython/hooks.py in result_display(self, arg) 160 161 if self.rc.pprint: --> 162 out = pformat(arg) 163 if '\n' in out: 164 # So that multi-line strings line up with the left column of /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pprint.py in pformat(self, object) 109 def pformat(self, object): 110 sio = _StringIO() --> 111 self._format(object, sio, 0, 0, {}, 0) 112 return sio.getvalue() 113 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pprint.py in _format(self, object, stream, indent, allowance, context, level) 127 self._readable = False 128 return --> 129 rep = self._repr(object, context, level - 1) 130 typ = _type(object) 131 sepLines = _len(rep) > (self._width - 1 - indent - allowance) /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pprint.py in _repr(self, object, context, level) 193 def _repr(self, object, context, level): 194 repr, readable, recursive = self.format(object, context.copy(), --> 195 self._depth, level) 196 if not readable: 197 self._readable = False /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pprint.py in format(self, object, context, maxlevels, level) 205 and whether the object represents a recursive construct. 206 """ --> 207 return _safe_repr(object, context, maxlevels, level) 208 209 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/pprint.py in _safe_repr(object, context, maxlevels, level) 290 return format % _commajoin(components), readable, recursive 291 --> 292 rep = repr(object) 293 return rep, (rep and not rep.startswith('<')), False 294 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py in __repr__(self) 106 107 def __repr__(self): --> 108 return repr(self._get_data()) 109 110 def __len__(self): /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py in _get_data(self) 480 def _get_data(self): 481 if self._result_cache is None: --> 482 self._result_cache = list(self.iterator()) 483 return self._result_cache 484 /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/backends/oracle/base.py in iterator(self) 120 121 cursor = connection.cursor() --> 122 cursor.execute(full_query, params) 123 124 fill_cache = self._select_related /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/backends/util.py in execute(self, sql, params) 17 start = time() 18 try: ---> 19 return self.cursor.execute(sql, params) 20 finally: 21 stop = time() /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/backends/oracle/base.py in execute(self, query, params) 468 query = query[:-1] 469 query = smart_str(query, self.charset) % tuple(args) --> 470 return Database.Cursor.execute(self, query, params) 471 472 def executemany(self, query, params=None): <class 'cx_Oracle.DatabaseError'>: ORA-01425: escape character must be character string of length 1
Change History (4)
comment:1 by , 17 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 17 years ago
Cc: | added |
---|
comment:3 by , 17 years ago
Keywords: | oracle db backend startswith istartswith added |
---|
Note:
See TracTickets
for help on using tickets.
It works for me. Frank, can you find out for us what query is actually being executed?