Reputation: 402
I am using Spatialite (coming with QGIS 3.16).
I have a query that collects records to insert them into a table I created for this purpose. I set the geometry type of the geometry column to MULTIPOLYGON :
CREATE TABLE parkings_combinés_lycées (
identifiant_lycée VARCHAR(10),
surface_totale_m² FLOAT,
"%_emprise_dans_parcelles_lycées" FLOAT );
However, inserting data (using a INSERT INTO .. SELECT .. query) fails with the error message :
parkings_combinés_lycées.geom violates Geometry constraint [geom-type or SRID not allowed]
I checked the records returned by the SELECT statement using the function ST_GeometryType and indeed some record have POLYGON geometries while others have MULTIPOLYGON geometries.
How do I solve this ? Setting another geometry type in the CREATE TABLE ?
Upvotes: 0
Views: 421
Reputation: 402
I just found that the function CastToMultiPolygon does the trick !
Upvotes: 0