Opened 9 years ago

Closed 6 years ago

#16184 closed Bug (fixed)

GeoDjango inspectdb fails for PostGIS

Reported by: radim.blazek@… Owned by: nobody
Component: GIS Version: master
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


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) (1.3 KB) - added by radim.blazek@… 9 years ago.
Patch for multiple 'geometry' types

Download all attachments as: .zip

Change History (6)

Changed 9 years ago by radim.blazek@…

Attachment: added

Patch for multiple 'geometry' types

comment:1 Changed 9 years ago by Bas Peschier

Has patch: set
Version: 1.3SVN

comment:2 Changed 9 years ago by Aymeric Augustin

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:3 Changed 9 years ago by Ramiro Morales

Keywords: inspectdb added

comment:4 Changed 7 years ago by anonymous

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

comment:5 Changed 6 years ago by Claude Paroz <claude@…>

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

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