Opened 13 years ago

Closed 10 years ago

#16184 closed Bug (fixed)

GeoDjango inspectdb fails for PostGIS

Reported by: radim.blazek@… Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords: inspectdb
Cc: radim.blazek@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

GeoDjango inspectdb fails for PostGIS if there are more data types 'geometry' (in more schemas) because PostGISIntrospection.get_postgis_types() is taking simply the first one. Patch is attached.

Another problem is that PostGISIntrospection.get_geometry_type() raises exception if a geometry column has no record in geometry_column which is quite usual. In that case I would suggest to return simply

return 'TextField', {}

instead of raising exception.

Attachments (1)

introspection.py.patch (1.3 KB ) - added by radim.blazek@… 13 years ago.
Patch for multiple 'geometry' types

Download all attachments as: .zip

Change History (6)

by radim.blazek@…, 13 years ago

Attachment: introspection.py.patch added

Patch for multiple 'geometry' types

comment:1 by Bas Peschier, 13 years ago

Has patch: set
Version: 1.3SVN

comment:2 by Aymeric Augustin, 13 years ago

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:3 by Ramiro Morales, 13 years ago

Keywords: inspectdb added

comment:4 by anonymous, 11 years ago

Doesn't work for two geometry-columns in one Table!

comment:5 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In f12b68af71efa0b061710c83364f231734d07e55:

Fixed #16184 -- Fixed multiple PostGIS types introspection

Thanks radim.blazek@… for the report and initial patch.
Testing is tricky, as the failure condition is a bit of an edge
case. inspectapp.InspectDbTests should at least guarantee non
regression.

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