Re: Dyamic updates of NEW with pl/pgsql - Mailing list pgsql-hackers

From Merlin Moncure
Subject Re: Dyamic updates of NEW with pl/pgsql
Date
Msg-id b42b73151003112009t6b92bbecka0ea7237550ffcd0@mail.gmail.com
Whole thread Raw
In response to Re: Dyamic updates of NEW with pl/pgsql  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Dyamic updates of NEW with pl/pgsql
List pgsql-hackers
On Wed, Mar 10, 2010 at 7:50 AM, Andrew Dunstan <andrew@dunslane.net> wrote:
>>> 2010/3/9 strk <strk@keybit.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


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Warning about invalid .pgpass passwords
Next
From: Alvaro Herrera
Date:
Subject: Re: Dyamic updates of NEW with pl/pgsql