oracle/python-oracledb

Django doesn't work with the latest Oracle database (Oracle bug 36807094)

csirmazbendeguz opened this issue · 11 comments

Hello!

Django doesn't work with the latest Oracle database.

When I run Django's test suite (runtests.py), the database raises an unexpected error ORA-00600.
The error is raised in the post_migrate signal when inserting rows into the AUTH_PERMISSION table.
Interestingly, it manages to create the tables, but it fails on Permission.objects.bulk_insert.

I tried thick mode, it doesn't work.
I tried disable_oob=True, it doesn't work.

  1. What versions are you using?

23.4.0.0
platform.platform: Windows-10-10.0.22631-SP0
sys.maxsize > 2**32: True
platform.python_version: 3.11.3
oracledb.version: 2.2.1

  1. Is it an error or a hang or a crash?

error

  1. What error(s) or behavior you are seeing?

ORA-00600

Stack trace: https://gist.github.com/csirmazbendeguz/220b6dd0d4058159f1e1b020e519ca2f

  1. Does your application call init_oracle_client()?

no

  1. Include a runnable Python script that shows the problem.
runtests.py "tests/migrations" --verbosity=3 --settings=test_oracle

https://code.djangoproject.com/wiki/OracleTestSetup

Django doesn't work with the latest Oracle database.

To be precise, it crashes with Oracle Database 23ai Free.

Thanks for the report. We will look into it!

We have confirmed that it can be reproduced with 23ai, but not with 19c. The internal bug number is 36807094 for any who may wish to contact Oracle Support regarding this issue.

We have confirmed that it can be reproduced with 23ai, but not with 19c. The internal bug number is 36807094 for any who may wish to contact Oracle Support regarding this issue.

Thanks 👍 I'll only add that it also works with Oracle 23c.

Thanks 👍 I'll only add that it also works with Oracle 23c.

Can you specify which version exactly? You can print the output of connection.version for both cases -- the one that succeeds and the one that fails. Thanks!

@anthony-tuininga , I couldn't find any older versions on the official Oracle website, but the image 23.2 from here: https://hub.docker.com/r/gvenzl/oracle-free works for me.

Thanks 👍 I'll only add that it also works with Oracle 23c.

Can you specify which version exactly? You can print the output of connection.version for both cases -- the one that succeeds and the one that fails. Thanks!

It works with:

  • Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0
  • Oracle Database 23c Free, Release 23.0.0.0.0 - Developer-Release Version 23.2.0.0.0

and crashes with:

  • Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.4.0.24.05
cjbj commented

Since the problem isn't in python-oracledb, I'm going to re-label this issue (to keep BUG for python-oracledb tasks).

(PS Django/Oracle users, please support django/django#17834 which is a PR to add connection pooling to Django !)

cjbj commented

From investigation by @suraj-ora-2020 the problem doesn't occur with VARCHAR2. This is yet-another-reason to migrate Django away from NVARCHAR2. See end of 1.3 in
https://docs.oracle.com/en/database/oracle/dmu/23.1/dumag/ch1_overview.html#GUID-3CA04A80-4870-469F-9FBB-0578779E7622

“Oracle does not recommend the use of national character set data types

From investigation by @suraj-ora-2020 the problem doesn't occur with VARCHAR2. This is yet-another-reason to migrate Django away from NVARCHAR2. See end of 1.3 in https://docs.oracle.com/en/database/oracle/dmu/23.1/dumag/ch1_overview.html#GUID-3CA04A80-4870-469F-9FBB-0578779E7622

“Oracle does not recommend the use of national character set data types

We could reconsider using VARCHAR2/CHAR datatypes instead of NVARCHAR2/NCHAR, but we need to have a clear (and as painless as possible) migration path for our users 😞