Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#6666 closed (fixed)

Oracle test case failure

Reported by: Erin Kelly Owned by: Erin Kelly
Component: Database layer (models, ORM) Version: dev
Severity: 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

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

File "/home/ikelly/projects/django.trunk/tests/regressiontests/datatypes/models.py", line ?, in regressiontests.datatypes.models.__test__.API_TESTS
Failed example:
    Donut.objects.filter(baked_date__year=2006)
Exception raised:
    Traceback (most recent call last):
      File "/home/ikelly/projects/django.trunk/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest regressiontests.datatypes.models.__test__.API_TESTS[25]>", line 1, in <module>
        Donut.objects.filter(baked_date__year=2006)
      File "/home/ikelly/projects/django.trunk/django/db/models/query.py", line 108, in __repr__
        return repr(self._get_data())
      File "/home/ikelly/projects/django.trunk/django/db/models/query.py", line 483, in _get_data
        self._result_cache = list(self.iterator())
      File "/home/ikelly/projects/django.trunk/django/db/backends/oracle/base.py", line 123, in iterator
        cursor.execute(full_query, params)
      File "/home/ikelly/projects/django.trunk/django/db/backends/oracle/base.py", 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:

SELECT "DATATYPES_DONUT"."ID", "DATATYPES_DONUT"."NAME", "DATATYPES_DONUT"."IS_FROSTED", "DATATYPES_DONUT"."HAS_SPRINKLES", "DATATYPES_DONUT"."BAKED_DATE", "DATATYPES_DONUT"."BAKED_TIME", "DATATYPES_DONUT"."CONSUMED_AT"
 FROM "DATATYPES_DONUT" WHERE ("DATATYPES_DONUT"."BAKED_DATE" BETWEEN :arg0 AND :arg1) ORDER BY "DATATYPES_DONUT"."CONSUMED_AT" ASC

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

Change History (12)

comment:1 by Erin Kelly, 16 years ago

Status: newassigned

comment:2 by Jacob, 16 years ago

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

comment:3 by Erin Kelly, 16 years ago

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 by Malcolm Tredinnick, 16 years ago

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 by Malcolm Tredinnick, 16 years ago

Triage Stage: UnreviewedAccepted

comment:6 by Erin Kelly, 16 years ago

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 by Erin Kelly, 16 years ago

Resolution: fixed
Status: assignedclosed

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

comment:8 by Alex Gaynor, 16 years ago

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

comment:9 by Erin Kelly, 16 years ago

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/base.py", 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 by Malcolm Tredinnick, 16 years ago

Yeah, it'll just get merged.

comment:11 by shan <shan_triv@…>, 16 years ago

is this fix available in latest patch?

in reply to:  11 comment:12 by Erin Kelly, 16 years ago

Replying to shan <shan_triv@hotmail.com>:

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