I have to add a column to my points table storing the distance (metres) between each point and the nearest line. Both are in the same projected coordinate system. How can I do it? I've tried this but doesn't work:
ALTER TABLE st09_2019_01 ADD coast_dist_M float8;
INSERT INTO st09_2019_01 (coast_dist_M)
VALUES
(SELECT ST_Distance(st09_2019_01.geom, coastline_ln.shape)
FROM st09_2019_01, coastline_ln
ORDER BY ST_Distance(st09_2019_01.geom, coastline_ln.shape)
LIMIT 1)