--- a/django/db/backends/postgresql/creation.py	2009-12-22 15:18:51.000000000 +0000
+++ b/django/db/backends/postgresql/creation.py	2010-06-07 09:04:08.000000000 +0100
@@ -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 @@
 
             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) +
