I need get custom segment of any Linestring. For better understanding I've added image. 
Blue line is my Linestring which contains 3 points, and on the base of red point I need cut or fill line in same level as red point. How can I do that?
I use dijsktra function like that:
SELECT e.seq, e.path_seq, e.node, e.cost, e.agg_cost, w.name, w.the_geom, w.x1, w.y1, w.x2, w.y2, st_astext(w.the_geom)
FROM pgr_dijkstra('
SELECT gid AS id,
source,
target,
cost_s AS cost,
reverse_cost_s AS reverse_cost
FROM pgr.ways',
35959,
19303,
directed := true)e
left join pgr.ways w on w.gid = e.edge
order by e.seq
and on image are my first and last edges of result which are not corresponding with ending vertexes (red points), so I need edit this edges.