Opened 3 years ago
Last modified 3 years ago
#33789 closed Bug
Table and colums with more then 30 chars can no longer be found / queried after migrating from django 3.2 to 4.0 using an Oracle backend — at Initial Version
Description ¶
While in the proces of updating our project from Django 2.2 to 3.2 to 4.0 I noticed that things started to break down in 4.0.
Since upgrading to 4.0, tables with names longer than 30 chars fail with
ORA-00942: table or view does not exist
models with columns with names longer than 30 chars fail with
ORA-00904: "COMPONENT_ATTRIBUTE_METADATA"."REQUIRES_ILOM_CONNECT_FOR_DD63": invalid identifier
When I run the following on django 2.2 / 3.2 14 with python 3.6
from django.db.backends.utils import truncate_name truncate_name("very_long_database_table_or_column" length=30) Out[7]: 'VERY_LONG_DATABASE_TABLE_O20cb'
Then run the same on django 4.0.5 with python 3.9
from django.db.backends.utils import truncate_name truncate_name("very_long_database_table_or_column", length=30) Out[6]: 'very_long_database_table_o0c9a'
The hash value is different. As a result a table or column name is queried that does not exist, because they where created using the older algorithm.
I believe this was broken by this change: https://code.djangoproject.com/ticket/32653