From 2c5bd1b92fb810c88b627e3bb7ad47c229469543 Mon Sep 17 00:00:00 2001 From: prabatuty Date: Thu, 31 Jul 2008 10:29:24 +0000 Subject: [PATCH] *** empty log message *** --- trigger.psql | 74 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 37 insertions(+), 37 deletions(-) rewrite trigger.psql (80%) diff --git a/trigger.psql b/trigger.psql dissimilarity index 80% index 2f0fb130..c7d561a0 100644 --- a/trigger.psql +++ b/trigger.psql @@ -1,37 +1,37 @@ -CREATE LANGUAGE plpgsql; -CREATE FUNCTION log_insert() RETURNS trigger AS $triggerinsertp1$ -BEGIN -insert into csql_log_int (tablename, pkid, operation) values ('p1', NEW.f1, 1); -RETURN NEW; -END; -$triggerinsertp1$ LANGUAGE plpgsql; - -create trigger triggerinsertp1 -AFTER INSERT on p1 -FOR EACH ROW -EXECUTE PROCEDURE log_insert(); - -CREATE FUNCTION log_update() RETURNS trigger AS $triggerupdatep1$ -BEGIN -insert into csql_log_int (tablename, pkid, operation) values ('p1', OLD.f1, 2); -insert into csql_log_int (tablename, pkid, operation) values ('p1', NEW.f1, 1); -RETURN NEW; -END; -$triggerupdatep1$ LANGUAGE plpgsql; - -create trigger triggerupdatep1 -AFTER UPDATE on p1 -FOR EACH ROW -EXECUTE PROCEDURE log_update(); - -CREATE FUNCTION log_delete() RETURNS trigger AS $triggerdeletep1$ -BEGIN -insert into csql_log_int (tablename, pkid, operation) values ('p1', OLD.f1, 2); -RETURN NEW; -END; -$triggerdeletep1$ LANGUAGE plpgsql; - -create trigger triggerdeletep1 -AFTER DELETE on p1 -FOR EACH ROW -EXECUTE PROCEDURE log_delete(); +CREATE LANGUAGE plpgsql; +CREATE FUNCTION log_insert_t1() RETURNS trigger AS $triggerinsertt1$ +BEGIN +insert into csql_log_int (tablename, pkid, operation) values ('t1', NEW.f1, 1); +RETURN NEW; +END; +$triggerinsertt1$ LANGUAGE plpgsql; + +create trigger triggerinsertt1 +AFTER INSERT on t1 +FOR EACH ROW +EXECUTE PROCEDURE log_insert_t1(); + +CREATE FUNCTION log_update_t1() RETURNS trigger AS $triggerupdatet1$ +BEGIN +insert into csql_log_int (tablename, pkid, operation) values ('t1', OLD.f1, 2); +insert into csql_log_int (tablename, pkid, operation) values ('t1', NEW.f1, 1); +RETURN NEW; +END; +$triggerupdatet1$ LANGUAGE plpgsql; + +create trigger triggerupdatet1 +AFTER UPDATE on t1 +FOR EACH ROW +EXECUTE PROCEDURE log_update_t1(); + +CREATE FUNCTION log_delete_t1() RETURNS trigger AS $triggerdeletet1$ +BEGIN +insert into csql_log_int (tablename, pkid, operation) values ('t1', OLD.f1, 2); +RETURN NEW; +END; +$triggerdeletet1$ LANGUAGE plpgsql; + +create trigger triggerdeletet1 +AFTER DELETE on t1 +FOR EACH ROW +EXECUTE PROCEDURE log_delete_t1(); -- 2.11.4.GIT