Ticket #16455: 16455-r17171-v4.patch

File 16455-r17171-v4.patch, 1.5 KB (added by Christian Karrié, 12 years ago)

New path vor [17171]

  • django/contrib/gis/db/backends/postgis/creation.py

     
    33
    44class PostGISCreation(DatabaseCreation):
    55    geom_index_type = 'GIST'
    6     geom_index_opts = 'GIST_GEOMETRY_OPS'
    76
    87    def sql_indexes_for_field(self, model, f, style):
    98        "Return any spatial index creation SQL for the field."
     
    4241            if f.spatial_index:
    4342                # Spatial indexes created the same way for both Geometry and
    4443                # Geography columns
    45                 if f.geography:
    46                     index_opts = ''
    47                 else:
    48                     index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts)
     44               
    4945                output.append(style.SQL_KEYWORD('CREATE INDEX ') +
    5046                              style.SQL_TABLE(qn('%s_%s_id' % (db_table, f.column))) +
    5147                              style.SQL_KEYWORD(' ON ') +
    5248                              style.SQL_TABLE(qn(db_table)) +
    5349                              style.SQL_KEYWORD(' USING ') +
    5450                              style.SQL_COLTYPE(self.geom_index_type) + ' ( ' +
    55                               style.SQL_FIELD(qn(f.column)) + index_opts + ' );')
     51                              style.SQL_FIELD(qn(f.column)) + ' );')
    5652        return output
    5753
    5854    def sql_table_creation_suffix(self):
Back to Top