]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@12 d1b88da0-ebda-0310-925b-ed51d8...
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Jun 2004 09:30:26 +0000 (09:30 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Jun 2004 09:30:26 +0000 (09:30 +0000)
db/tests/helge/laurent-trigger.psql [new file with mode: 0644]

diff --git a/db/tests/helge/laurent-trigger.psql b/db/tests/helge/laurent-trigger.psql
new file mode 100644 (file)
index 0000000..f479a8c
--- /dev/null
@@ -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();