创建触发器函数
CREATE OR REPLACE FUNCTION "public"."test"()
RETURNS "pg_catalog"."trigger" AS $BODY$
BEGIN
If (NEW.a != OLD.a) THEN
update test2 set a = new.a where test2.pk_uid=new.pk_uid ;
END IF;
return null;
end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
创建触发器
CREATE TRIGGER "update_test_trigger" AFTER UPDATE ON "public"."test"
FOR EACH ROW
EXECUTE PROCEDURE "public"."test"();