tww
.tww_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
synchronize_level_with_altitude_on_cover()
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.level,'NaN') ), 2056); WHEN TG_OP = 'UPDATE' THEN IF NEW.level <> OLD.level OR (NEW.level IS NULL AND OLD.level IS NOT NULL) OR (NEW.level IS NOT NULL AND OLD.level IS NULL) THEN NEW.situation3d_geometry = ST_SetSRID( ST_MakePoint( ST_X(NEW.situation3d_geometry), ST_Y(NEW.situation3d_geometry), COALESCE(NEW.level,'NaN') ), 2056); ELSE IF ST_Z(NEW.situation3d_geometry) <> ST_Z(OLD.situation3d_geometry) THEN NEW.level = NULLIF(ST_Z(NEW.situation3d_geometry),'NaN'); END IF; END IF; END CASE; RETURN NEW; END;