Code

Opened 9 months ago

Closed 9 months ago

#20758 closed Bug (invalid)

PostGISCreation failed by index creation for PointField

Reported by: jarus 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

Attachments (0)

Change History (1)

comment:1 Changed 9 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.