Re: logging table changes - Mailing list pgsql-novice

From Matthias Leopold
Subject Re: logging table changes
Date
Msg-id 4C894985.7000006@aic.at
Whole thread Raw
In response to Re: logging table changes  ("Rob Richardson" <Rob.Richardson@rad-con.com>)
List pgsql-novice
Am 2010-09-09 20:31, schrieb Rob Richardson:
> So far in this thread, I haven't seen anybody answer what I consider to
> be a very important question about the original poster's requirements:
>
> Why are you updating the history table????
>
> If you update the history table, you lose old history.  Instead, I think
> you should be adding a new record to the history table for every
> alteration made to the old one.  The history table would have to contain
> a field for the type of change that was made (insert, update or delete).
>
> RobR
>

thx for all the answers so far

I wasn't thinking about updating the history table.

"adding a field in the audit table which contains the names of all the
fields which changed" meant adding this field to the history table
originally, so it gets filled along with all the others when every
change to a row is recorded. HOW to "easily" get the values to put there
i don't know, i don't even know if this approach is sensible at all.

the solutions in the other posts require me to know the field to audit
in advance. i'm searching for a "easy" solution where "everything" is
logged and i can make simple queries to the history table for changes in
ANY field.

i must admit i'm not too familiar with triggers and even functions, so
maybe i'm heading in the wrong direction or i'm simply asking too much.
i just thought that i can't be the only one who was looking for this
kind of functionality (which of course doesn't mean that there is an
"easy" solution)

i hope i could make myself clear

matthias





pgsql-novice by date:

Previous
From: Richard Broersma
Date:
Subject: Re: logging table changes
Next
From: Rodrigo Quezada
Date:
Subject: Getting The Last Entry