I often use PostGIS tables with a geometry column of type "Geometry" containing varying geometry types e.g. polygons and points. When opening the table in QGIS the Connections dialogue lists the table once for each different geometry type as expected. Today I converted a PostGIS table from MultiLineString to Geometry and added some point and polygon objects to the table. But QGIS does not recognize the change and has only one entry for the table in the Connections dialog with a Spatial Type of LineString. However, in PostGIS, if I query:
select distinct st_geometrytype(wkb_geometry)
from tracts_test;
I get:
"ST_LineString"
"ST_Polygon"
"ST_Point"
as expected.
I've tried adding and removing the spatial index, adding and removing the primary key, and creating a new table with create NEW_TABLE as select * from OLD_TABLE
; but in no case does QGIS see any geometry type other than LineString. What else should I be doing, or where else should I be looking, coerce QGIS into seeing the other geometry types in the table?
ALTER TABLE your_table ALTER COLUMN your_geom_name type geometry(Geometry, your_srid);
Also what doesSELECT f_table_name, f_geometry_column, srid, type FROM geometry_columns WHERE f_table_name = 'your_table_name';
return?ALTER TABLE tracts ALTER COLUMN wkb_geometry type geometry(Geometry, 2242);
andSELECT f_table_name, f_geometry_column, srid, type FROM geometry_columns WHERE f_table_name = 'tracts';' returns:
"tracts" "wkb_geometry" 2242 "GEOMETRY"`