Ticket #8901: 8901-fixindextruncation.diff
File 8901-fixindextruncation.diff, 951 bytes (added by , 14 years ago) |
---|
-
django/db/backends/postgresql/creation.py
a b 1 1 from django.db.backends.creation import BaseDatabaseCreation 2 from django.db.backends.util import truncate_name 2 3 3 4 class DatabaseCreation(BaseDatabaseCreation): 4 5 # This dictionary maps Field objects to their associated PostgreSQL column … … 51 52 52 53 def get_index_sql(index_name, opclass=''): 53 54 return (style.SQL_KEYWORD('CREATE INDEX') + ' ' + 54 style.SQL_TABLE(qn( index_name)) + ' ' +55 style.SQL_TABLE(qn(truncate_name(index_name,self.connection.ops.max_name_length()))) + ' ' + 55 56 style.SQL_KEYWORD('ON') + ' ' + 56 57 style.SQL_TABLE(qn(db_table)) + ' ' + 57 58 "(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) +