Hi Dries,
you've declared a table containing a Polygon Geometry:
SELECT AddGeometryColumn('m_convex', 'geometry', 28992, 'POLYGON', 2);
then the following INSERT fails reporting "geom-type or SRID not
allowed"
INSERT INTO m_convex (geometry)
SELECT ST_ConvexHull(ST_Collect(ms.geometry))
FROM m_staging As ms;
the most obvious cause explaining for this issue is that
after all you are actually attempting to insert a Geometry
of some forbidden type.
And here is the most plausible explanation: you are
expecting that ST_ConvexHull() must always return a
Polygon, as in:
SELECT ST_AsText(
ST_ConvexHull(
ST_GeomFromText('MULTIPOINT(1 1, 2 2, 1 2)', 4326)));
----------------------
POLYGON((1 1, 1 2, 2 2, 1 1))
anyway sometimes ST_ConvexHull() can legitimately return
non-Polygon results, as the following snippet exemplifies:
SELECT ST_AsText(
ST_ConvexHull(
ST_GeomFromText('MULTIPOINT(1 1)', 4326)));
--------------------
POINT(1 1)
bye Sandro