From: helge Date: Mon, 7 Jun 2004 09:30:26 +0000 (+0000) Subject: git-svn-id: http://svn.opengroupware.org/SOGo/trunk@12 d1b88da0-ebda-0310-925b-ed51d8... X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cedffeae35aa9c5738788ab660badd8f32253b8e;p=scalable-opengroupware.org git-svn-id: http://svn.opengroupware.org/SOGo/trunk@12 d1b88da0-ebda-0310-925b-ed51d893ca5b --- 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();