Ticket #13441: postgresql_max_name_length.diff

File postgresql_max_name_length.diff, 1.1 KB (added by Andrew Ball, 15 years ago)

patch to specify the maximum name length for PostgreSQL

  • django/db/backends/postgresql/operations.py

    diff -r 67fccb2ff1c0 django/db/backends/postgresql/operations.py
    a b  
    163163            if self.postgres_version[0:2] == (8,2):
    164164                if self.postgres_version[2] is None or self.postgres_version[2] <= 4:
    165165                    raise NotImplementedError('PostgreSQL 8.2 to 8.2.4 is known to have a faulty implementation of %s. Please upgrade your version of PostgreSQL.' % aggregate.sql_function)
     166
     167    def max_name_length(self):
     168        """
     169        Returns the maximum length of an identifier.
     170       
     171        Note that the maximum length of an identifier is 63 by default, but can
     172        be changed by recompiling PostgreSQL after editing the NAMEDATALEN
     173        macro in src/include/pg_config_manual.h .
     174       
     175        This implementation simply returns 63, but can easily be overridden by a
     176        custom database backend that inherits most of its behavior from this one.
     177        """
     178       
     179        return 63
Back to Top