Opened 2 years ago
Last modified 2 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 Version 1
Reported by: | Paul in 't Hout | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 4.0 |
Severity: | Release blocker | Keywords: | oracle |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
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.13 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