Thread: LOG table changes ...

LOG table changes ...

From
"raptor@tvskat.net"
Date:
hi,

I want to track every change made to several tables...and was wondering
what is the best way... What are my thoughts at the moment are to make a
table like this :

id, table_name, field_name, old_value, new_value, timestamp

and triggers to do the logging.
but this will probably generate alot of traffic (not so worrying at the moment)

As I side effect of this I want to be able to make a snapshot of the TABLE at specified time..
any ideas on this too...

tia.

P.S. Other way would be to make a duplicate table and transffer the whole record, but
dont think this is a good solution

Re: LOG table changes ...

From
Anton Nikiforov
Date:
raptor@tvskat.net wrote:
> hi,
>
> I want to track every change made to several tables...and was wondering
> what is the best way... What are my thoughts at the moment are to make a
> table like this :
>
> id, table_name, field_name, old_value, new_value, timestamp
>
> and triggers to do the logging.
> but this will probably generate alot of traffic (not so worrying at the moment)
>
> As I side effect of this I want to be able to make a snapshot of the TABLE at specified time..
> any ideas on this too...
>
> tia.
>
> P.S. Other way would be to make a duplicate table and transffer the whole record, but
> dont think this is a good solution
Hello!
I did almost the same by writing a trigger on PL/Ruby that is logging
all table changes + user + other information into the log table in XML
format (the format of  the table on which updation/insertion trigger is
fiered is absolutley free and not required to be defind at "compile time").
So you still can view all data changes and build the database but my way
  is cappable to view who when changed what, but to build a database
actual at exact moment is difficult enough but still possible.

Best regards,
Anton

Attachment

Re: LOG table changes ...

From
Marius Andreiana
Date:
On Mon, 2004-07-19 at 14:52 +0300, raptor@tvskat.net wrote:
> hi,
>
> I want to track every change made to several tables...and was wondering
> what is the best way...
See this
http://archives.postgresql.org/pgsql-sql/2002-01/msg00274.php

--
Marius Andreiana
Galuna - Solutii Linux in Romania
http://www.galuna.ro