On Sun, May 19, 2013 at 7:33 AM, Shai Berger <[email protected]> wrote: > Hi, > > In my quest to solve Oracle bugs, I found the function datetime_cast_sql() in > the Oracle backend. It causes a problem these days, because it gets in the way > of querying a date as string (mydate__startswith='2005'). It is a function > that is defined as a no-op in the base backend, and overridden, among core > backends, only in Oracle. Removing the override, currently, just makes one > more test pass, and if we decide to remove it from the base, code in several > other places may become simpler (will not need to special-case datetime > values). > > I was able to track the history of this function, into the mists of time. In > the beginning, code to cast strings into dates for Oracle was mixed in with > the general querying code. Then came the boulder-oracle-sprint of 2006-2007, > where, at some point, that piece of code was factored out to a module-level > function get_datetime_cast_sql(), which was defined in all backends as a no-op > except Oracle; this was later refactored into the DatabaseOperations class we > know today. > > However, at about the same time that the DatabaseOperations was created, the > Oracle backend made another change: It started setting the session's datetime > format on login. This, as far as I understand, makes the special casting > operation redundant -- and current test results support my understanding. > > So -- I want to fix, now, the thing that was, well, not broken, but bent, in > 2007. And my question to you -- especially, those of you who participated in > the boulder sprint -- can you think of any reason why I shouldn't?
You may be right. One thing I would be concerned about is the reliability of only doing implicit date conversions. If you google for "ORA-01843" you can find a good number of forum posts that recommend against relying on the NLS_TIMESTAMP_FORMAT setting. See also Django ticket #20292. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
