Opened 11 years ago

Closed 11 years ago

#20758 closed Bug (invalid)

PostGISCreation failed by index creation for PointField

Reported by: Christoph Heer Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords: GeoDjango, Index, Test
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I want to test my GeoDjango project but the index creation a PointField fails.

   db_type = f.db_type(connection=self.connection)
>  if db_type.startswith('varchar'):
E  AttributeError: 'NoneType' object has no attribute 'startswith'

The PointField returns only None in this state. The if statements are only relevant for VARCHAR or TEXT fields but not for Geo Fields.
Patch: https://github.com/django/django/pull/1367

Change History (1)

comment:1 by Claude Paroz, 11 years ago

Resolution: invalid
Status: newclosed

Indexes for geometry fields should be specified with spatial_index (which defaults to True anyway), not db_index:
https://docs.djangoproject.com/en/dev/ref/contrib/gis/model-api/#spatial-index

Note: See TracTickets for help on using tickets.
Back to Top