Received: from smtp-5.ig.com.br (smtp-5.ig.com.br [200.226.132.154]) by postgresql.org (8.11.3/8.11.1) with SMTP id f6QEO8f45780 for ; Thu, 26 Jul 2001 10:24:08 -0400 (EDT) (envelope-from edipoelder@ig.com.br) Message-Id: <200107261424.f6QEO8f45780@postgresql.org> Received: (qmail 28083 invoked from network); 26 Jul 2001 14:23:45 -0000 Received: from webmail-9.ig.com.br (HELO localhost) (200.225.157.214) by smtp-5.ig.com.br with SMTP; 26 Jul 2001 14:23:45 -0000 Date: Thu, 26 Jul 2001 11:23:48 -0300 To: pgsql-sql@postgresql.org From: Edipo Elder Fernandes de Melo Cc: X-Originating-IP: [200.225.157.214]200.19.161.175 X-Mailer: InMail by Insite - www.insite.com.br X-user: edipoelder@ig.com.br Subject: Need help in how to.... X-Archive-Number: 200107/347 X-Sequence-Number: 4161 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/