Need help in how to....

From: Edipo Elder Fernandes de Melo <edipoelder(at)ig(dot)com(dot)br>
To: pgsql-sql(at)postgresql(dot)org
Subject: Need help in how to....
Date: 2001-07-26 14:23:48
Message-ID: 200107261424.f6QEO8f45780@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)ig(dot)com(dot)br]

_________________________________________________________
Oi! Voc quer um iG-mail gratuito?
Ento clique aqui: http://registro.ig.com.br/

Browse pgsql-sql by date

  From Date Subject
Next Message Barry Lind 2001-07-26 16:34:31 Re: [SQL] When PostgreSQL compliant JDBC 2.0? (Batch updates)
Previous Message frederic romagna 2001-07-25 17:55:53 about cursor