pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Gavin <gavin@grabias.com>
To: pgsql-sql@postgresql.org
Subject: Re: Function To Log Changes
Date: Mon, 5 Apr 2004 10:18:26 -0700
Message-ID: <200404051018.26429.josh@agliodbs.com> (raw)
In-Reply-To: <50616.63.65.2.36.1081184499.squirrel@www.grabias.com>
References: <50616.63.65.2.36.1081184499.squirrel@www.grabias.com>

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




view thread (5+ messages)  latest in thread

Message-ID: <200404051018.26429.josh@agliodbs.com>
Permalink:  ../200404051018.26429.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200404051018.26429.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, gavin@grabias.com
  Subject: Re: Function To Log Changes
  In-Reply-To: <200404051018.26429.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox