Working with Trigger in Postgresql and QGIS Part II

preview_player
Показать описание
#qgis #postgresql #surveykshak
How to work with Triggers in Postgresql and QGIS Part II.
In this video we have added two triggers : How to update length in meter and kilometer in their respective field.

The command we have run in videos are as below:
--Add column
ALTER TABLE roads ADD COLUMN length_km double precision;

--Create trigger function
CREATE OR REPLACE FUNCTION length_m_trigger_function() RETURNS trigger AS $$
BEGIN
NEW.length_m=(st_length(NEW.geom))::decimal(10,2);
RETURN NEW;
END;
$$ language plpgsql;

--Apply trigger to table
CREATE TRIGGER length_m_trigger
BEFORE INSERT OR UPDATE
ON roads
FOR EACH ROW
EXECUTE PROCEDURE length_m_trigger_function();

--Projection transformation of layer

Your queries:-
Working with Trigger in Postgresql and QGIS,
trigger in postgresql,
trigger in postgresql example,
trigger in postgresql function,
trigger in postgresql stackoverflow,
trigger in postgresql query,
drop trigger in postgresql,
disable trigger in postgresql,
update trigger in postgresql,
enable trigger in postgresql,
calculate length with trigger in postgresql,

Leave your query on my telegram channel.

DISCLAIMER

The Information provided on, from or through this channel is general in nature and is solely for educational purposes.
00:00 Introduction
01:25 Length trigger
09:00 Projection transformation
Рекомендации по теме