tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
synchronize_level_with_altitude_on_wastewater_node()
Parameters
Name
Type
Mode
IN
Definition
BEGIN CASE WHEN TG_OP = 'INSERT' THEN NEW.situation3d_geometry = ST_SetSRID( ST_MakePoint( ST_X(NEW.situation3d_geometry), ST_Y(NEW.situation3d_geometry), COALESCE(NEW.bottom_level,'NaN') ), 2056); WHEN TG_OP = 'UPDATE' THEN IF NEW.bottom_level <> OLD.bottom_level OR (NEW.bottom_level IS NULL AND OLD.bottom_level IS NOT NULL) OR (NEW.bottom_level IS NOT NULL AND OLD.bottom_level IS NULL) THEN NEW.situation3d_geometry = ST_SetSRID( ST_MakePoint( ST_X(NEW.situation3d_geometry), ST_Y(NEW.situation3d_geometry), COALESCE(NEW.bottom_level,'NaN') ), 2056); ELSE IF ST_Z(NEW.situation3d_geometry) <> ST_Z(OLD.situation3d_geometry) THEN NEW.bottom_level = NULLIF(ST_Z(NEW.situation3d_geometry),'NaN'); END IF; END IF; END CASE; RETURN NEW; END;