Hi,
I doing a log to my DB. For this, I writing a trigger that inserts in a
log table the user, date, table changed and values changed.
I was trying to do a generic procedure and use it on all tables, like
this:
create function sp_log() returns opaque as '
declare v_type text; v_taable text; v_oid text; v_old text; v_new text;
begin v_type := tg_op; v_table := tg_relname; v_oid := tg_relid; -- v_old := old::text; -- v_new :=
new::text; insert into log (tablechanged, action, old_values, new_values, user) values (v_tabela, v_tipo, v_old,
v_new,current_user); return new;
end;' language 'plpgsql';
How I do to get the old and new values in a generic way (without use
coluns names or any else that bind a specific table)?
Thanks for all help,
Edipo Elder [edipoelder@ig.com.br]
_________________________________________________________
Oi! Voc� quer um iG-mail gratuito?
Ent�o clique aqui: http://registro.ig.com.br/