ices-eg / wg_WGEEL

Joint EIFAAC/ICES/GFCM Working Group on Eels
http://ices.dk/community/groups/Pages/WGEEL.aspx
5 stars 12 forks source link

the trigger to update the coordinates does not work #193

Closed cedricbriandgithub closed 2 years ago

cedricbriandgithub commented 2 years ago

CREATE TRIGGER update_coordinates AFTER UPDATE OF geom ON datawg.t_series_ser FOR EACH ROW EXECUTE FUNCTION datawg.update_coordinates()

fires

column geom does not exist ????

elfunesto commented 2 years ago

how did you received this error, i.e. how did you try updating the geom?

cedricbriandgithub commented 2 years ago

UPDATE datawg.t_series_ser SET geom = ST_transform(ST_SETSRID(ST_MakePoint(417768.557,6779552.138 ),3067),4326) WHERE ser_nameshort='VesiY';--1

cedricbriandgithub commented 2 years ago

database edition 2021 line 1134

elfunesto commented 2 years ago

Fixed: a new was missing in the function (NEW.geom): here is the sql used command to fix. If needed, you can run the update command that had been fired

CREATE OR REPLACE FUNCTION datawg.update_coordinates() RETURNS trigger LANGUAGE plpgsql AS $function$ BEGIN NEW.ser_x = st_x(NEW.geom); NEW.ser_y = st_y(NEW.geom); RETURN NEW; END; $function$ ;