From 1413c1fbca77654a9213d743232a4a34ac0fdce2 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 7 Jun 2004 09:37:33 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@13 d1b88da0-ebda-0310-925b-ed51d893ca5b --- db/tests/helge/laurent-trigger.psql | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/db/tests/helge/laurent-trigger.psql b/db/tests/helge/laurent-trigger.psql index f479a8c6..05456d34 100644 --- a/db/tests/helge/laurent-trigger.psql +++ b/db/tests/helge/laurent-trigger.psql @@ -1,15 +1,17 @@ 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; + 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 +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