Postgres crie gatilho, se não existe

-- SYNTAX
CRRATE TRIGGER trigger_name {BEFORE|AFTER|INSTEAD OF} { event [ OR ... ] }
ON table_name
[ FROM referenced_table_name ]
[ NOT DEFERRABLE | [ DEFERRABLE ] [ INITIALLY IMMEDIATE | INITIALLY DEFERRED ] ]
[ REFERENCING { { OLD | NEW } TABLE [ AS ] transition_relation_name } [ ... ] ]
[ FOR [ EACH ] { ROW | STATEMENT } ]
[ WHEN ( condition ) ]
EXECUTE {FUNCTION|PROCEDURE} function_name ( arguments )

-- EXAMPLE
CREATE TRIGGER test_trigger
  AFTER INSERT
  ON test_table
  FOR EACH ROW
  EXECUTE PROCEDURE test();
Lucky-Magnet