SELECT
ST_AsText(ST_MakeLine(
ST_MakePoint(ST_X(ST_PointN(geom, 1)), ST_Y(ST_PointN(geom, 1)), ST_Z(ST_PointN(geom, 1))*10),
ST_MakePoint(ST_X(ST_PointN(geom, 2)), ST_Y(ST_PointN(geom, 2)), ST_Z(ST_PointN(geom, 2)))
)) AS merged_line
FROM "line3d2"
WHERE gid = 20570;
UPDATE line3d2
SET geom = ST_SetSRID(
ST_MakeLine(
ST_MakePoint(ST_X(ST_PointN(geom, 1)), ST_Y(ST_PointN(geom, 1)), -ST_Z(ST_PointN(geom, 1))),
ST_MakePoint(ST_X(ST_PointN(geom, 2)), ST_Y(ST_PointN(geom, 2)), -ST_Z(ST_PointN(geom, 2)))
),
ST_SRID(geom)
)
WHERE gid != 20570;