django.db.backends.oracle reported ORA-01882: timezone region not found
|Reported by:||konglingkai@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.4|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
this seem to be a problem on line 487 of django.db.oracle.base.py:
cursor.execute("ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'"
" NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'"
" NLS_TERRITORY = 'AMERICA'"
line487 ===> + (" TIME_ZONE = 'UTC'" if settings.USE_TZ else ))
Repro of the issue:
The bug will happen when I have "USE_TZ=True" in the project settings (which is default), and I happen not to have UTC timezone on the oracle server, there is no way for me to change the TIME_ZONE settings, the only way is to turn off USE_TZ.
the fix can be having UTC as default, and read from settings instead of hard code here.