Index: django/db/backends/postgresql/creation.py
===================================================================
--- django/db/backends/postgresql/creation.py	(revision 11876)
+++ django/db/backends/postgresql/creation.py	(working copy)
@@ -34,3 +34,40 @@
         if settings.TEST_DATABASE_CHARSET:
             return "WITH ENCODING '%s'" % settings.TEST_DATABASE_CHARSET
         return ''
+
+    def sql_indexes_for_field(self, model, f, style):
+        if f.db_index and not f.unique:
+            from django.db.models.fields import CharField, TextField
+            qn = self.connection.ops.quote_name
+            db_table = model._meta.db_table
+            tablespace = f.db_tablespace or model._meta.db_tablespace
+            if tablespace:
+                sql = self.connection.ops.tablespace_sql(tablespace)
+                if sql:
+                    tablespace_sql = ' ' + sql
+                else:
+                    tablespace_sql = ''
+            else:
+                tablespace_sql = ''
+
+            def get_index_sql(index_name, opclass=''):
+                return (style.SQL_KEYWORD('CREATE INDEX') + ' ' +
+                        style.SQL_TABLE(qn(index_name)) + ' ' +
+                        style.SQL_KEYWORD('ON') + ' ' +
+                        style.SQL_TABLE(qn(db_table)) + ' ' +
+                        "(%s%s)" % (style.SQL_FIELD(qn(f.column)), opclass) +
+                        "%s;" % tablespace_sql)
+
+            output = [get_index_sql('%s_%s' % (db_table, f.column))]
+
+            # CharFields and TextFields require a second index that specifies
+            # their operator class for performing LIKE queries. See #12234.
+            if isinstance(f, CharField):
+                output.append(get_index_sql('%s_%s_like' % (db_table, f.column),
+                                            ' varchar_pattern_ops'))
+            elif isinstance(f, TextField):
+                output.append(get_index_sql('%s_%s_like' % (db_table, f.column),
+                                            ' text_pattern_ops'))
+        else:
+            output = []
+        return output
