Re: Function To Log Changes

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Gavin" <gavin(at)grabias(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Function To Log Changes
Date: 2004-04-05 17:18:26
Message-ID: 200404051018.26429.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Gavin,

> Hi All, I have been tinkering with a function to log the changes made on
> any column through a function and trigger. However, I cant think of a way
> to make this work through pl/pgsql. Any one have any ideas, or is it just
> not possible?

It could be done, but would be extremely slow and awkward using current PL/
pgsql syntax. You'd have to query the system tables for a list of columns,
and then execute a series of dynamic queries.

I recommend instead one of the following two approaches:

1) Simply log the whole row of each archived table and don't worry about
logging the individual columns, or

2) Use PL/tcl, PL/Pyton, or C where you can select columnns by ordinal
position or other dynamic factor.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-04-05 17:39:28 Re: Function To Log Changes
Previous Message Gavin 2004-04-05 17:01:39 Function To Log Changes