PostgreSQL: Trigger template

PHOTO EMBED

Mon Aug 29 2022 15:59:39 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #sql

create function f_thetable_biud()
returns trigger as
$body$
--declare vars
begin
    -- new, old
    -- tg_op = INSERT,DELETE,UPDATE
    return new/old;
end;
$body$ language plpgsql;

create trigger t_thetable_biud
before/after insert or update or delete
on thetable
for each row execute procedure f_thetable_biud();
content_copyCOPY