[Django] #33789: 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

8 views
Skip to first unread message

Django

unread,
Jun 16, 2022, 10:25:51 AM6/16/22
to django-...@googlegroups.com
#33789: 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
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
badeendjuh |
Type: Bug | Status: new
Component: Database | Version: 4.0
layer (models, ORM) |
Severity: Normal | Keywords: oracle
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
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

--
Ticket URL: <https://code.djangoproject.com/ticket/33789>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 16, 2022, 10:35:47 AM6/16/22
to django-...@googlegroups.com
#33789: 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
-------------------------------------+-------------------------------------
Reporter: badeendjuh | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.0
(models, ORM) |
Severity: Normal | Resolution:
Keywords: oracle | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by badeendjuh:

Old 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

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

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33789#comment:1>

Reply all
Reply to author
Forward
0 new messages