Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#6666 closed (fixed)

Oracle test case failure

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


[7150] introduced a test case that fails in Oracle. The traceback is:

File "/home/ikelly/projects/django.trunk/tests/regressiontests/datatypes/", line ?, in regressiontests.datatypes.models.__test__.API_TESTS
Failed example:
Exception raised:
    Traceback (most recent call last):
      File "/home/ikelly/projects/django.trunk/django/test/", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest regressiontests.datatypes.models.__test__.API_TESTS[25]>", line 1, in <module>
      File "/home/ikelly/projects/django.trunk/django/db/models/", line 108, in __repr__
        return repr(self._get_data())
      File "/home/ikelly/projects/django.trunk/django/db/models/", line 483, in _get_data
        self._result_cache = list(self.iterator())
      File "/home/ikelly/projects/django.trunk/django/db/backends/oracle/", line 123, in iterator
        cursor.execute(full_query, params)
      File "/home/ikelly/projects/django.trunk/django/db/backends/oracle/", line 506, in execute
        return Database.Cursor.execute(self, query, params)
    DatabaseError: ORA-01830: date format picture ends before converting entire input string

The generated query and bind parameters are:


('2007-01-01 00:00:00', '2007-12-31 23:59:59.999999')

Change History (12)

comment:1 Changed 9 years ago by ikelly

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 9 years ago by jacob

Looks like this is because of the microseconds at the end of the second param, right?

comment:3 Changed 9 years ago by ikelly

Yes, that's what it looks like to me. I plan to take a closer look at this later; I just opened the ticket so I wouldn't forget about it.

comment:4 Changed 9 years ago by mtredinnick

Doesn't that mean the bug existed prior to that change as well. I can't see what's changed if the database engine isn't "sqlite3" in that patch. It previously read

return ['%s-01-01 00:00:00' % value, '%s-12-31 23:59:59.999999' % value]

which has the same structure. Can somebody explain what silly typo I've overlooked here?

comment:5 Changed 9 years ago by mtredinnick

  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 9 years ago by ikelly

Yeah, I don't think that [7150] introduced the bug. As far as I can see, the only reason the test case didn't fail before was that it didn't exist yet. It's strange, though, because there are other tests of year lookups that pass. I suspect this is probably an issue of DateField versus DateTimeField, and that it's probably trivial to fix, but I'll need to take a closer look.

comment:7 Changed 8 years ago by ikelly

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [7274]) Fixed #6666: Corrected a bind param formatting issue when performing 'year' lookups on DateFields using Oracle.

comment:8 Changed 8 years ago by Alex

Does this still need to be fixed in qs-rf?

comment:9 Changed 8 years ago by ikelly

Not sure, but probably. I just tried tried running the test case in qs-rf and got an ImportError:

  File "/home/ikelly/projects/django.qs-rf/django/db/backends/oracle/", line 103, in query_set_class
    from django.db.models.query import EmptyResultSet, GET_ITERATOR_CHUNK_SIZE, quote_only_if_word
ImportError: cannot import name GET_ITERATOR_CHUNK_SIZE

AFAICT, the change I committed is entirely orthogonal to the changes in qs-rf, so there should be no trouble merging it in.

comment:10 Changed 8 years ago by mtredinnick

Yeah, it'll just get merged.

comment:11 follow-up: Changed 8 years ago by shan <shan_triv@…>

is this fix available in latest patch?

comment:12 in reply to: ↑ 11 Changed 8 years ago by ikelly

Replying to shan <>:

is this fix available in latest patch?

I'm not sure what patch you're referring to, but this fix has been in trunk since revision [7274], if that's what you mean.

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