tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ws_symbology_update_by_reach()
Parameters
Name
Type
Mode
IN
Definition
DECLARE _ne_from_id TEXT; _ne_to_id TEXT; symb_attribs RECORD; re_obj_id TEXT; BEGIN CASE WHEN TG_OP = 'UPDATE' THEN re_obj_id = OLD.obj_id; WHEN TG_OP = 'INSERT' THEN re_obj_id = NEW.obj_id; WHEN TG_OP = 'DELETE' THEN re_obj_id = OLD.obj_id; END CASE; BEGIN SELECT ne.obj_id INTO STRICT _ne_from_id FROM tww_od.reach re LEFT JOIN tww_od.reach_point rp ON rp.obj_id = re.fk_reach_point_from LEFT JOIN tww_od.wastewater_networkelement ne ON ne.obj_id = rp.fk_wastewater_networkelement WHERE re.obj_id = re_obj_id; EXECUTE tww_app.update_wastewater_node_symbology(_ne_from_id); EXCEPTION WHEN NO_DATA_FOUND THEN -- DO NOTHING, THIS CAN HAPPEN WHEN TOO_MANY_ROWS THEN RAISE EXCEPTION 'TRIGGER ERROR ws_symbology_update_by_reach. Subquery shoud return exactly one row. This is not supposed to happen and indicates an isue with the trigger. The issue must be fixed in TWW.'; END; BEGIN SELECT ne.obj_id INTO STRICT _ne_to_id FROM tww_od.reach re LEFT JOIN tww_od.reach_point rp ON rp.obj_id = re.fk_reach_point_to LEFT JOIN tww_od.wastewater_networkelement ne ON ne.obj_id = rp.fk_wastewater_networkelement WHERE re.obj_id = re_obj_id; EXECUTE tww_app.update_wastewater_node_symbology(_ne_to_id); EXCEPTION WHEN NO_DATA_FOUND THEN -- DO NOTHING, THIS CAN HAPPEN WHEN TOO_MANY_ROWS THEN RAISE EXCEPTION 'TRIGGER ERROR ws_symbology_update_by_reach. Subquery shoud return exactly one row. This is not supposed to happen and indicates an isue with the trigger. The issue must be fixed in TWW.'; END; RETURN NEW; END;