Please help
От | Tariq Muhammad |
---|---|
Тема | Please help |
Дата | |
Msg-id | Pine.LNX.4.21.0204101147230.21405-100000@genesis.int.libertyrms.com обсуждение исходный текст |
Ответ на | Re: Timestamps and performances problems (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-admin |
Hi Folks I am trying to write a function that should archive old values to an archiving table before update on the orignal table but it inserts both old and new values to the archiving table here is the code: CREATE FUNCTION fn_archive_01() RETURNS OPAQUE AS ' BEGIN /* TG_OP is the function (UPDATE, DELETE, SELECT) */ INSERT INTO customer_archive VALUES (OLD.id, OLD.name,current_user,now(),TG_OP); IF TG_OP = ''UPDATE'' THEN RETURN NEW; END IF; RETURN OLD; END; ' LANGUAGE 'plpgsql'; CREATE TRIGGER tr_customer_archive_del BEFORE DELETE ON customer FOR EACH ROW EXECUTE PROCEDURE fn_archive_01(); Thanks for your help Tariq
В списке pgsql-admin по дате отправления: