Assuming the general case where
- your table has a column
geom of type GEOMETRY(GEOMETRY) (meaning that it allows for any SRID and any geometry type, which is the only way you were able to import those MultiPoints in the first place)
- your geometries are in fact referenced in the given CRS, but were imported without the SRID
you will need to re-insert your data in the way you intend to, as an UPDATE cannot expand a single row into a set of rows. PostgreSQL offers data-modifying CTEs that break this down into a single statement:
WITH
del AS (
DELETE FROM <your_table>
WHERE GeometryType(geom) = 'MULTIPOINT'
RETURNING (<your_table>.*)
)
INSERT INTO <your_table> ([<column_list>,] geom) (
SELECT [<column_list>,]
ST_SetSRID(dmp.geom, 7844)
FROM del,
LATERAL ST_Dump(geom) AS dmp
);
This will
- find and
DELETE rows where the geometry type is MultiPoint in the CTE (improve the WHERE filter if needed), RETURNING them into the virtual del table
INSERT a geometry dump of the deleted geometries in del back into <your_table> in the main INSERT query
However:
If your MultiPoints are strictly single part geometries (meaning that they always only contain one point), you are able to indeed run an UPDATE:
UPDATE <your_table>
SET geom = ST_SetSRID(ST_GeometryN(geom, 1), 7844)
WHERE GeometryType = 'MULTIPOINT'
;
Some notes:
- if avoidable, do not have a generic
GEOMETRY(GEOMETRY) column, especially without SRID constraint
- this is then better handled on import, likely with a
BEFORE INSERT trigger, or before import in the client application