signalo
.signalo_app
Tables
(current)
Columns
Constraints
Relationships
Orphan Tables
Anomalies
Routines
ft_azimut_update()
Parameters
Name
Type
Mode
IN
Definition
BEGIN IF NOT ST_Equals(ST_StartPoint(NEW.geometry), ST_StartPoint(OLD.geometry)) THEN RAISE EXCEPTION 'Start point should remain unchanged'; END IF; IF ST_NumPoints(NEW.geometry) != 2 THEN RAISE EXCEPTION 'The line should have only 2 vertices'; END IF; UPDATE signalo_db.azimut SET azimut = degrees(ST_Azimuth(ST_StartPoint(NEW.geometry), ST_EndPoint(NEW.geometry))) WHERE id = NEW.id; RETURN NEW; END;