Re: Accessing fields in RECORD data type using variables as field names

From: Richard Huxton <dev(at)archonet(dot)com>
To: "Alistair Hopkins" <alistair(at)berthengron(dot)co(dot)uk>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Accessing fields in RECORD data type using variables as field names
Date: 2003-12-03 17:49:02
Message-ID: 200312031749.02805.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 03 December 2003 13:36, Alistair Hopkins wrote:
> Hi,
>
> I am trying to write a generic audit-trail trigger function which will
> record changes on a field-by-field basis to a single table for all audited
> tables.
>
> However, I find that I can only access a field in OLD and NEW if I know the
> name in advance. Is there any way I can access the fields when I only have
> a variable containing the name of the field?
>
> If I can do this, I can make a really simple, schema-change-resistent, low
> storage size audit trail for high read / low change databases.

Not in plpgsql, but I believe you can in pl/tcl, which I think is quite
mature.

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2003-12-03 17:52:32 Re: Transaction Question
Previous Message Bopolissimus Platypus 2003-12-03 17:16:49 Any *current* summary of postgres-r 7.2 status? (was Re: Feature Request for 7.5)