ST_AddPoint — Aggiunge un punto a una stringa di linee.
geometry ST_AddPoint(geometry linestring, geometry point);
geometry ST_AddPoint(geometry linestring, geometry point, integer position = -1);
Aggiunge un punto a una stringa di linee prima dell'indice position (utilizzando un indice basato su 0). Se il parametro position è omesso o è -1, il punto viene aggiunto alla fine della stringa di linee.
Disponibilità: 1.1.0
            
 Questa funzione supporta il 3d e non distrugge gli z-index. 
Add a point to the end of a 3D line
SELECT ST_AsEWKT(ST_AddPoint('LINESTRING(0 0 1, 1 1 1)', ST_MakePoint(1, 2, 3)));
    st_asewkt
    ----------
    LINESTRING(0 0 1,1 1 1,1 2 3)
        Guarantee all lines in a table are closed by adding the start point of each line to the end of the line only for those that are not closed.
UPDATE sometable SET geom = ST_AddPoint(geom, ST_StartPoint(geom)) FROM sometable WHERE ST_IsClosed(geom) = false;