Re: Dyamic updates of NEW with pl/pgsql

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: depesz(at)depesz(dot)com, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org, strk(at)keybit(dot)net
Subject: Re: Dyamic updates of NEW with pl/pgsql
Date: 2010-03-12 04:09:45
Message-ID: b42b73151003112009t6b92bbecka0ea7237550ffcd0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 10, 2010 at 7:50 AM, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>>> 2010/3/9 strk <strk(at)keybit(dot)net>:
>>>> How can a pl/pgsql trigger change the
>>>> values of dynamic fields in NEW record ?
>>>>
>>>> By "dynamic" I mean that the field name
>>>> is a variable in the trigger context.
>>>>
>>>> I've been told it's easy to do with pl/perl but
>>>> I'd like to delive a pl/pgsql solution to have
>>>> less dependencies.
>
> Using an hstore in 9.0 it's not too bad, Try something like:
>

Agree 100%. The new hstore going to completely nail a broad class of
issues that have historically been awkward in plpgsql functions.
(small aside: the other biggie would be able to push a composite type
in to an update statement...something like 'update foo set foo =
new'). This is really great...some variant of this question is
continually asked it seems.

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2010-03-12 04:24:37 Re: Dyamic updates of NEW with pl/pgsql
Previous Message Andrew Dunstan 2010-03-12 03:39:35 Re: Warning about invalid .pgpass passwords