Opened 11 years ago

Closed 10 years ago

#20647 closed Bug (duplicate)

Trying to get repr() or str() on a queryset that has been .select_for_update() causes oracle backend to throw ORA00907

Reported by: kimvais@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords: oracle
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Shai Berger)

Doing anything that would get a string representation of any QuerySet that has been selected for update (.select_of_update()) on oracle backend causes the following stacktrace

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 77, in __repr__
    data = list(self[:REPR_OUTPUT_SIZE + 1])
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 92, in __len__
    self._result_cache.extend(self._iter)
  File "/usr/lib/python2.6/site-packages/django/db/models/query.py", line 301, in iterator
    for row in compiler.results_iter():
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 775, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/lib/python2.6/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql
    cursor.execute(sql, params)
  File "/usr/lib/python2.6/site-packages/django/db/backends/oracle/base.py", line 717, in execute
    six.reraise(utils.DatabaseError, utils.DatabaseError(*tuple(e.args)), sys.exc_info()[2])
  File "/usr/lib/python2.6/site-packages/django/db/backends/oracle/base.py", line 710, in execute
    return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-00907: missing right parenthesis

Attachments (1)

20647-test.diff (749 bytes ) - added by Tim Graham 11 years ago.

Download all attachments as: .zip

Change History (3)

by Tim Graham, 11 years ago

Attachment: 20647-test.diff added

comment:1 by Tim Graham, 11 years ago

Triage Stage: UnreviewedAccepted

Reproduced with the attached regression test.

comment:2 by Shai Berger, 10 years ago

Description: modified (diff)
Resolution: duplicate
Status: newclosed

As can be seen in the stack trace, this is because the query is sliced for presentation -- which means this is really a duplicate of the more focused #23147.

The test case should be added when the problem is solved, though.

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