1 CREATE LANGUAGE plpgsql;
2 CREATE FUNCTION log_insert() RETURNS trigger AS $triggerinsertp1$
4 insert into csql_log_int (tablename, pkid, operation) values ('p1', NEW.f1, 1);
7 $triggerinsertp1$ LANGUAGE plpgsql;
9 create trigger triggerinsertp1
12 EXECUTE PROCEDURE log_insert();
14 CREATE FUNCTION log_update() RETURNS trigger AS $triggerupdatep1$
16 insert into csql_log_int (tablename, pkid, operation) values ('p1', OLD.f1, 2);
17 insert into csql_log_int (tablename, pkid, operation) values ('p1', NEW.f1, 1);
20 $triggerupdatep1$ LANGUAGE plpgsql;
22 create trigger triggerupdatep1
25 EXECUTE PROCEDURE log_update();
27 CREATE FUNCTION log_delete() RETURNS trigger AS $triggerdeletep1$
29 insert into csql_log_int (tablename, pkid, operation) values ('p1', OLD.f1, 2);
32 $triggerdeletep1$ LANGUAGE plpgsql;
34 create trigger triggerdeletep1
37 EXECUTE PROCEDURE log_delete();