Hi,

On Wed, 14 Apr 2021 12:10:56 +0100
"'Adam Johnson' via Django developers  (Contributions to Django
itself)" <django-developers@googlegroups.com> wrote:

> Hi
> 
> This seems like a genuine bug, Django should not assume that all
> backends have the same max table name length. Please file a ticket.
> 

Right, but it may be a simpler bug than the one you have in mind.

> >
> > Issue i've found is that if i try and call the model
> > `ThisIsAReallyLongModelNameThatIsAlsoVeryOld.objects.using('old').count()`
> > i get an error saying that the table
> > `APP_THISISAREALLYLONGMODEL5300` does not exist, when it should be
> > using `APP_THISISAREALLYLONGMODEL5BD6` instead.

So, you get two different name truncations -- one if the model is
instantiated with Oracle as the default connection (presumably that's
the 5BD6 one), and another if it is instantiated with Postgres and
later used via Oracle. I'd venture as far as guessing that the
difference is that only in one of the cases, the name is turned to
uppercase before shortening; this is how it was in a similar old case,
solved years ago (there, the names of auto-generated through-tables for
ManyToManyField were shortened in a different way than
explicitly-created models, and hilarious breakage ensued when anyone
wanted to add a field to a through table).

I suspect the only fix needed is to make the two ways match
(in favor of the "instantiated on Oracle" way). I doubt it would even
require a deprecation.

HTH,
        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/20210414143506.627f53ce.shai%40platonix.com.
  • Iss... Javier Buzzi
    • ... 'Adam Johnson' via Django developers (Contributions to Django itself)
      • ... Shai Berger
        • ... Javier Buzzi

Reply via email to