Opened 5 years ago

Closed 5 years ago

#30847 closed Bug (worksforme)

Geodjango not respecting spatial_index=False.

Reported by: Thomas Steen Rasmussen Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hello,

I believe the logic in https://github.com/django/django/blob/master/django/contrib/gis/db/backends/postgis/schema.py#L17-L18 is inverted. The index is always created regardless of the setting of spatial_index=False. This should be easy to fix, just return False instead of True in L18 :)

Change History (2)

comment:1 by Thomas Steen Rasmussen, 5 years ago

Summary: PostGIS not respecting spatial_index=FalseGeodjango not respecting spatial_index=False

comment:2 by Mariusz Felisiak, 5 years ago

Easy pickings: unset
Resolution: worksforme
Status: newclosed
Summary: Geodjango not respecting spatial_index=FalseGeodjango not respecting spatial_index=False.
Version: 2.2master

I don't see any issue in this code, PostGISSchemaEditoe._field_should_be_indexed() calls super()_field_should_be_indexed() if field doesn't have a spatial_index attribute or if it is set to False.

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