[GIS] QGIS There isn’t entry in geometry_columns!

postgisqgis

In PostgreSQL v9.3 with PostGIS v2.1 extensions I created a view from two tables (sites & visits). The site table contained a point geometry column (the_geom), which was included in the created view. Checking the table view it contained the expected information.

In QGIS v2.4 running under Windows 8.1, the sites table containing the geometry column can be added as a layer. However, when looking at the created view table in the DB Manager, it states:

PostGIS

Column: the_geom Geometry: GEOMETRY Dimension: 2 Extent:
482350.00000, 132750.00000 – 538750.00000, 177150.00000

 There isn't entry in geometry_columns!

The table tab shows the table contents as expected, and the preview shows the points which looks reasonable. The icon for the view table is shown as a question mark.

When the view was first created, it could not be added as a layer to the map. However, rebooting my computer has enabled the view to be added as a layer to the map.

Two questions:

  1. What does the error message mean, and how I do I get rid of it?
  2. Why did I need to reboot my computer to add the view table to the
    map?

Best Answer

So I just encountered this exact issue - and asked the same questions. I'm not sure about question number 2, other than a hunch that the server had to restart in order to register the data types without the PostGIS constraints applied (the geometry_column missing and all).

I found this post, which worked on my tables that had the exact same question marks and errors as yours. I ran this successfully:

WITH
t AS (SELECT table_schema, table_name
                FROM information_schema.tables
                WHERE table_schema = 'public' AND table_type = 'BASE TABLE')
SELECT Populate_Geometry_Columns((table_schema::text || '.' || table_name::text)::regclass) FROM t;

The tables are registered with their spatial constraints appropriately, so everything is nice and clean!

Related Question