tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
symbology_on_reach_point_update()
Parameters
Name
Type
Mode
IN
Definition
DECLARE rp_obj_id text; _ws_obj_id text; ne_obj_ids text[]; ne_obj_id text; BEGIN CASE WHEN TG_OP = 'UPDATE' THEN IF (NEW.fk_wastewater_networkelement = OLD.fk_wastewater_networkelement) THEN RETURN NEW; END IF; rp_obj_id = OLD.obj_id; ne_obj_ids := ARRAY[OLD.fk_wastewater_networkelement, NEW.fk_wastewater_networkelement]; WHEN TG_OP = 'INSERT' THEN rp_obj_id = NEW.obj_id; ne_obj_ids := ARRAY[NEW.fk_wastewater_networkelement]; WHEN TG_OP = 'DELETE' THEN rp_obj_id = OLD.obj_id; ne_obj_ids := ARRAY[OLD.fk_wastewater_networkelement]; END CASE; UPDATE tww_od.reach SET progression3d_geometry = progression3d_geometry WHERE fk_reach_point_from = rp_obj_id OR fk_reach_point_to = rp_obj_id; --To retrigger the calculate_length trigger on reach update FOREACH ne_obj_id IN ARRAY ne_obj_ids LOOP SELECT ws.obj_id INTO _ws_obj_id FROM tww_od.wastewater_structure ws LEFT JOIN tww_od.wastewater_networkelement ne ON ws.obj_id = ne.fk_wastewater_structure LEFT JOIN tww_od.reach_point rp ON ne.obj_id = ne_obj_id; EXECUTE tww_app.update_wastewater_structure_label(_ws_obj_id); EXECUTE tww_app.update_depth(_ws_obj_id); END LOOP; RETURN NEW; END;