Cutting linestrings with points?
Best non-topology solution ever.. it REALLY works fast and easy (believe me i tested lots of ways to do this):
--please add this function:
https://github.com/Remi-C/PPPP_utilities/blob/master/postgis/rc_split_multi.sql
-- please create a universal sequence for unique id multipurpose
CREATE SEQUENCE select_id
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1
CYCLE;
-- lines (non st_unioned linestrings, with gist index) : linetable
-- points (non st_unioned points, with gist index) : pointtable
-- first, lines with cuts (pointtable)
create table segment_lines_00 as (
WITH points_intersecting_lines AS(
SELECT lines.id AS lines_id, lines.geom AS line_geom, ST_Collect(points.ix) AS blade
FROM
linetable as lines,
pointtable as points
WHERE st_dwithin(lines.geom, points.ix, 4) = true
GROUP BY lines.id, lines.geom
)
SELECT lines_id, rc_Split_multi(line_geom, blade, 4)
FROM points_intersecting_lines
);
CREATE INDEX ON segment_lines_00 USING gist(rc_split_multi);
-- then, segments cutted by points
create table segment_lines_01 as (
select
(ST_Dump(rc_split_multi)).geom as geom, nextval('SELECT_id'::regclass) AS gid from segment_lines_00
);
CREATE INDEX ON segment_lines_01 USING gist(geom);