From cedffeae35aa9c5738788ab660badd8f32253b8e Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 7 Jun 2004 09:30:26 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@12 d1b88da0-ebda-0310-925b-ed51d893ca5b --- db/tests/helge/laurent-trigger.psql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 db/tests/helge/laurent-trigger.psql diff --git a/db/tests/helge/laurent-trigger.psql b/db/tests/helge/laurent-trigger.psql new file mode 100644 index 00000000..f479a8c6 --- /dev/null +++ b/db/tests/helge/laurent-trigger.psql @@ -0,0 +1,15 @@ +CREATE FUNCTION mise_a_jour_t2() RETURNS trigger AS ' + BEGIN + IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN + update table2 set champ2 = champ2 +1 where... ; + RETURN NEW; + ELSE IF TG_OP = 'DELETE' + update table2 set champ2 = champ2 -1 where ... ; + RETURN OLD ; + END IF; + END; + +' LANGUAGE plpgsql; + +CREATE TRIGGER mise_a_jour AFTER INSERT OR UPDATE OR DELETE ON table1 + FOR EACH ROW EXECUTE PROCEDURE mise_a_jour_t2(); -- 2.39.5