I user ALTER TABLE
to change a Multilinestring geometry column to a Linestrings geometry column with this syntax:
ALTER TABLE jalan_diy
ALTER COLUMN geom TYPE Geometry(LINESTRING, 4326)
USING (ST_Dump(geom)).geom;
and I got an error like this...
ERROR: transform expression must not return a set
SQL state: 42804
ALTER ... USING
(and several other locations in SQL) for a multitude of reasons. If your Multi/Collection geometries your are attempting to re-type always have a single LineString as the only component, use... USING ST_GeometryN(geom, 1)
. In every other case you will have to create a new table with the dumped results.ST_IsValid
, everything seems ok...ST_GeometryN
and multilinestrings with n geom fix byST_Dump
?? can u give me some example? i try but still doesnt workALTER TABLE jalan_diy ALTER COLUMN geom TYPE Geometry(LINESTRING, 4326) CASE WHEN ST_NumGeometries(geom) = 1 THEN USING ST_GeometryN(geom, 1) ELSE USING (ST_Dump(geom)).geom;
ANDALTER TABLE jalan_diy ALTER COLUMN geom TYPE Geometry(LINESTRING, 4326) USING (ST_Dump(geom)).geom WHERE ST_NumGeometries(geom) > 1;