diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-06-21 11:48:45 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-06-21 11:48:45 +0000 |
| commit | 6ab3fea11314d66b3b28b680684ad0423ed8b665 (patch) | |
| tree | 0428be93b5908ec681792098825540cbf713bf4d /django/db/backends/postgresql/creation.py | |
| parent | b46639f5707c7a368de29f3b71b6dd4f811e0c85 (diff) | |
Fixed #8901 -- Reapplied r13328 (with extra docs) now that we have a 1.3 development branch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@13363 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/creation.py')
| -rw-r--r-- | django/db/backends/postgresql/creation.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/django/db/backends/postgresql/creation.py b/django/db/backends/postgresql/creation.py index af26d0b78f..e3587f0e37 100644 --- a/django/db/backends/postgresql/creation.py +++ b/django/db/backends/postgresql/creation.py @@ -1,4 +1,5 @@ from django.db.backends.creation import BaseDatabaseCreation +from django.db.backends.util import truncate_name class DatabaseCreation(BaseDatabaseCreation): # This dictionary maps Field objects to their associated PostgreSQL column @@ -51,7 +52,7 @@ class DatabaseCreation(BaseDatabaseCreation): def get_index_sql(index_name, opclass=''): return (style.SQL_KEYWORD('CREATE INDEX') + ' ' + - style.SQL_TABLE(qn(index_name)) + ' ' + + style.SQL_TABLE(qn(truncate_name(index_name,self.connection.ops.max_name_length()))) + ' ' + style.SQL_KEYWORD('ON') + ' ' + style.SQL_TABLE(qn(db_table)) + ' ' + "(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) + |
