ST_MAKEVALID: ERROR: Geometry type (MultiPolygon) does not match column type (Polygon)

Previous answers might fail if you already have data (Polygon type) in your db.

To solve this with present polygon-type data: sql ALTER TABLE your_table ALTER COLUMN your_geocolumn TYPE geometry (multipolygon, 4326) USING ST_Multi(your_geocolumn);


Your incoming geometries are multipolygons, while the datatype of the geometry is polygons. These are incompatible, and hence you should convert the data type of your column to multipolygons, so that you can save the valid geometries.

This can be achieved by the following command:

Alter table  table1 alter column geom type geometry ( multipolygon,srid)

see sections 4.3.1 - 4.3.4 for more information on the SPATIAL_REF_SYS table, creating spatial tables and the postGIS GEOMETRY_COLUMNS view table.

Tags:

Postgis