Re: logging table changes

From: Mladen Gogala <mgogala(at)vmsinfo(dot)com>
To: Matthias Leopold <matthias(at)aic(dot)at>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: logging table changes
Date: 2010-09-09 17:44:15
Message-ID: 4C891CEF.6040809@vmsinfo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Matthias Leopold wrote:
> hi,
>
> how can i "easily" log changes to individual fields in a table without
> naming these fields explicitly? i looked at the auditing example in
> http://www.postgresql.org/docs/8.3/static/plpgsql-trigger.html, which
> looks promising, but i can't think of a way to "easily" query the table
> when i want to know when a certain field changed. i was thinking of
> adding a field in the audit table which contains the names of all the
> fields which changed, but i don't know who to "easily" get these names.
> for some reason i think that there might already exist well known
> solutions for my problem so i dare to ask here.
>
> thx for advice
>
> matthias
>
>
Postgres 9.0 will allow you to execute trigger only when the column of
your choice is changed:
http://www.postgresql.org/docs/9.0/static/sql-createtrigger.html
Look at the "WHEN" part.

--

Mladen Gogala
Sr. Oracle DBA
1500 Broadway
New York, NY 10036
(212) 329-5251
http://www.vmsinfo.com
The Leader in Integrated Media Intelligence Solutions

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Rob Richardson 2010-09-09 17:48:13 Re: logging table changes
Previous Message Rob Richardson 2010-09-09 17:13:59 Re: Query help, please