ST_RemovePoint — Removes point from a linestring. Offset is 0-based.
geometry ST_RemovePoint(geometry linestring, integer offset
Removes point from a linestring. Useful for turning a closed ring into an open line string
This function supports 3d and will not drop the z-index.
--guarantee no LINESTRINGS are closed --by removing the end point. The below assumes the_geom is of type LINESTRING UPDATE sometable SET the_geom = ST_RemovePoint(the_geom, ST_NPoints(the_geom) - 1) FROM sometable WHERE ST_IsClosed(the_geom) = true;