Opened 5 years ago

Closed 2 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@… 5 years ago.
Patch for multiple 'geometry' types

Download all attachments as: .zip

Change History (6)

Changed 5 years ago by radim.blazek@…

Patch for multiple 'geometry' types

comment:1 Changed 5 years ago by bpeschier

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from 1.3 to SVN

comment:2 Changed 5 years ago by aaugustin

  • Needs tests set
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by ramiro

  • Keywords inspectdb added

comment:4 Changed 3 years ago by anonymous

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

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

  • Resolution set to fixed
  • Status changed from new to closed

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