### Eclipse Workspace Patch 1.0
#P django-trunk
|
|
|
10 | 10 | from django.contrib.gis.db.models.fields import GeometryField |
11 | 11 | |
12 | 12 | output = super(PostGISCreation, self).sql_indexes_for_field(model, f, style) |
13 | | |
| 13 | postgis_version = self.connection.ops.postgis_version_tuple()[1:] |
| 14 | |
14 | 15 | if isinstance(f, GeometryField): |
15 | 16 | gqn = self.connection.ops.geo_quote_name |
16 | 17 | qn = self.connection.ops.quote_name |
… |
… |
|
45 | 46 | if f.geography: |
46 | 47 | index_opts = '' |
47 | 48 | else: |
48 | | index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts) |
| 49 | # Check for PostGIS Version |
| 50 | # PostGIS 2.0 does not support GIST_GEOMETRY_OPS |
| 51 | if postgis_version >= (2, 0): |
| 52 | index_opts = '' |
| 53 | else: |
| 54 | index_opts = ' ' + style.SQL_KEYWORD(self.geom_index_opts) |
49 | 55 | output.append(style.SQL_KEYWORD('CREATE INDEX ') + |
50 | 56 | style.SQL_TABLE(qn('%s_%s_id' % (db_table, f.column))) + |
51 | 57 | style.SQL_KEYWORD(' ON ') + |