Opened 9 years ago

Closed 9 years ago

#25428 closed New feature (wontfix)

Allow configuring the database's identifier max length in the DATABASES setting

Reported by: Hugo Tácito Owned by: nobody
Component: Core (Other) Version: 1.8
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Can we please define a MAX_NAME_LENGTH in the DATABASE settings instead of using a fixed number as we can see at the method django.db.backends.postgresql.operations.DatabaseOperations.max_name_length

Example of use:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'test',
        'USER': 'postgres',
        'PASSWORD': '',
        'HOST': '127.0.0.1',
        'PORT': '5432',
        'MAX_NAME_LENGTH': '128'
    }
}

Change History (1)

comment:1 by Tim Graham, 9 years ago

Resolution: wontfix
Status: newclosed
Summary: MAX_NAME_LENGTH in the DATABASE settingsAllow configuring the database's identifier max length in the DATABASES setting

As noted in the docstring of the max_name_length() method, "This implementation simply returns 63, but can easily be overridden by a custom database backend that inherits most of its behavior from this one."

We try to avoid the complexity of new settings or configuration points where other solutions already exist. We could possibly make it configurable in DATABASES['database']['OPTIONS'], but I don't know that this is such a common need that it's necessary. You could write to the DevelopersMailingList for a second opinion. Thanks!

Note: See TracTickets for help on using tickets.
Back to Top