﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
20292	Django 1.5.1: ORA-01843: not a valid month	Carsten Fuchs	nobody	"With

  - Django 1.5.1
  - cx_Oracle-5.1.2

we're  seeing error ""ORA-01843: not a valid month"" when saving data.
'''This problem does not occur with Django 1.4.x or cx_Oracle 5.0.3! '''

I originally reported this problem on django-users:
https://groups.google.com/d/msg/django-users/jeUCYd1lYkE/sJUQ7Z5oZnAJ

A similar report is at:
http://stackoverflow.com/questions/15525312/django-oracle-backend-error

----

This is the model definition that we're seeing the problem with:

{{{
#!python
class Erfasst(models.Model):
    id            = models.AutoField(primary_key=True)
    key           = models.ForeignKey(Mitarbeiter, db_column='key', to_field='key', on_delete=models.PROTECT)

    datum         = models.DateField()
    status        = models.ForeignKey(Status, db_column='status', on_delete=models.PROTECT)

    anfang        = models.CharField(max_length=8, blank=True)
    ende          = models.CharField(max_length=8, blank=True)
    pause         = models.CharField(max_length=8, blank=True)
    faktor        = models.SmallIntegerField(choices=[(60, ""1.0""), (90, ""1.5""), (120, ""2.0"")], default=60)

    bonus_url     = models.DecimalField(max_digits=5, decimal_places=2, null=True, blank=True, verbose_name=u'Bonus-Urlaub')
    bemerkung     = models.CharField(max_length=40, blank=True)
    bereich       = models.ForeignKey(Bereich, null=True, blank=True, on_delete=models.PROTECT)
    zustand       = models.SmallIntegerField(db_column='flag')

    approved_by   = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT, related_name='approved_set')
    approved_at   = models.DateTimeField(null=True, blank=True)

    last_user     = models.ForeignKey(User, null=True, blank=True, on_delete=models.PROTECT)
    last_modified = models.DateTimeField(auto_now=True, null=True)
}}}

And this is an example from `./manage.py shell` that reproduces the error:

{{{
#!python
>>> from Lori.models import *
>>> st = Status.objects.get(id=1)
>>> ma = Mitarbeiter.objects.get(key=""F200"")
>>> e = Erfasst(key=ma, datum=date(2013, 12, 12), status=st, bemerkung=""Test CF"", zustand=1)
>>> e.save()
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"", line 546, in save
    force_update=force_update, update_fields=update_fields)
  File ""/usr/local/lib/python2.6/dist-packages/django/db/models/base.py"", line 650, in save_base
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
  File ""/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py"", line 215, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File ""/usr/local/lib/python2.6/dist-packages/django/db/models/query.py"", line 1661, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File ""/usr/local/lib/python2.6/dist-packages/django/db/models/sql/compiler.py"", line 937, in execute_sql
    cursor.execute(sql, params)
  File ""/usr/local/lib/python2.6/dist-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/local/lib/python2.6/dist-packages/django/db/backends/oracle/base.py"", line 710, in execute
    return self.cursor.execute(query, self._param_generator(params))
DatabaseError: ORA-01843: not a valid month
}}}

(As a side note, from our live site I didn't receive any of the usual error e-mails that normally are reliably sent whenever an application error occurs.)
"	Bug	closed	Database layer (models, ORM)	1.5	Normal	fixed	Oracle, cx_oracle, unicode	shai@… mcallister.sean@…	Accepted	0	0	0	0	0	0
