tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
symbology_update_by_channel()
Parameters
Name
Type
Mode
IN
Definition
DECLARE _ne_from_id TEXT; _ne_to_id TEXT; ch_obj_id TEXT; BEGIN CASE WHEN TG_OP = 'UPDATE' THEN ch_obj_id = OLD.obj_id; WHEN TG_OP = 'INSERT' THEN ch_obj_id = NEW.obj_id; WHEN TG_OP = 'DELETE' THEN ch_obj_id = OLD.obj_id; END CASE; BEGIN SELECT ne.obj_id INTO _ne_from_id FROM tww_od.wastewater_networkelement ch_ne LEFT JOIN tww_od.reach re ON ch_ne.obj_id = re.obj_id LEFT JOIN tww_od.reach_point rp ON re.fk_reach_point_from = rp.obj_id LEFT JOIN tww_od.wastewater_networkelement ne ON rp.fk_wastewater_networkelement = ne.obj_id WHERE ch_ne.fk_wastewater_structure = ch_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_channel. 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 _ne_to_id FROM tww_od.wastewater_networkelement ch_ne LEFT JOIN tww_od.reach re ON ch_ne.obj_id = re.obj_id LEFT JOIN tww_od.reach_point rp ON re.fk_reach_point_to = rp.obj_id LEFT JOIN tww_od.wastewater_networkelement ne ON rp.fk_wastewater_networkelement = ne.obj_id WHERE ch_ne.fk_wastewater_structure = ch_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_channel. 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;