Changes between Version 3 and Version 4 of Ticket #32653, comment 5


Ignore:
Timestamp:
Apr 15, 2021, 4:17:58 AM (4 years ago)
Author:
Javier Buzzi

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32653, comment 5

    v3 v4  
    11@Mariusz the issue is see with your solution is that it will work from my current case Postgres as `default`, Oracle as `old`. Where Postgres wont change the `db_table` as long as its under 63 chars??? But if we have the inverse, Oracle as `default` and Postgres as `new`; it will break Postgres since the `db_table` would be something like `backends_verylongmodelname1234` and Postgres would want the whole string `backends_verylongmodelnamezzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz`. This is because the `default` connection is used to setup the table names at startup https://github.com/django/django/blob/stable/3.2.x/django/db/models/options.py#L207 . The solution @Simon suggested would work on both cases.
    22
    3 Ideally, the line `self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())` would be removed, and the aliases that is done in the `SQLCompiler` be moved to the indivial backend, and that way you can cache the table names for later use.
     3Ideally, the line `self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())` would be removed, and the aliases that is done in the `SQLCompiler` be moved to the individual backend, and that way you can cache the table names for later use.
Back to Top