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? ...

1 Answer 1


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.


  • Can you explain how you solved this? I have the same problem. Thanks!!! Jul 29, 2013 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, 2013 at 5:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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