Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to generate models for an existing Postgresql database using the Django InspectDB command. Models are produced but a failure occurs on the raster_columns view. The error is:

 Exception: Could not find a geometry or geography column for "raster_columns"."extent". Inspectdb does not continue generating models for the remaining tables.

This makes sense because raster_columns is a system view created by Postgis. Looking at the definition of the geography/geometry_columns views, the raster_columns table is explicitly filtered out from them. Since the Extent field in raster_columns is a spatial type but does not exist in the geometry/geography_columns views, the model generation fails.

Anybody know how to get around this aside from generating the models by hand? ...

share|improve this question
up vote 0 down vote accepted

In doing some research for the question, I decided to comment out the raster_columns filter on the geometry_columns view.

--AND NOT (n.nspname = 'public'::name AND c.relname = 'raster_columns'::name)

That allowed me to successfully generate the models since the raster_columns view was now cataloged in the geometry_columns view.

I then uncommented the line and recreated the geometry_columns view, returning it to the state it was in before I altered it.


share|improve this answer
Can you explain how you solved this? I have the same problem. Thanks!!! – user2625773 Jul 29 '13 at 21:15
Let me know what specific information you need, I did an overview of how I fixed the problem in the answer. I can give you more details, just let me know. – akthor Oct 15 '13 at 5:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.