oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
309 stars 62 forks source link

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

Open csirmazbendeguz opened 1 week ago

csirmazbendeguz commented 1 week ago

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

felixxm commented 1 week ago

Django doesn't work with the latest Oracle database.

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

anthony-tuininga commented 1 week ago

Thanks for the report. We will look into it!

anthony-tuininga commented 1 week ago

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.

felixxm commented 1 week ago

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 :+1: I'll only add that it also works with Oracle 23c.

anthony-tuininga commented 1 week ago

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!

csirmazbendeguz commented 1 week ago

@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.

felixxm commented 1 week ago

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:

and crashes with:

anthony-tuininga commented 1 week ago

Thanks, @felixxm!

cjbj commented 1 week ago

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 https://github.com/django/django/pull/17834 which is a PR to add connection pooling to Django !)

cjbj commented 2 days ago

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

felixxm commented 2 days ago

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 :disappointed: