Re: proposal: plpgsql - iteration over fields of rec or row variable

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David E(dot) Wheeler <david(at)kineticode(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: proposal: plpgsql - iteration over fields of rec or row variable
Date: 2010-11-09 20:02:21
Message-ID: 1289332764-sup-8121@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Excerpts from Merlin Moncure's message of mar nov 09 16:41:32 -0300 2010:

> The only exception I see is in trigger functions. If the trigger
> function plan is specific to the firing trigger, new and old are
> defined at plan time, so something like:
>
> new{TG_FIELDNAMES[1]} = 5; -- is ok (at least IMO), since
> TG_FIELDNAMES is immutable (at least to the plan).
>
> I don't honestly know if it's worth it -- the main case is performance
> (plus Pavel's secondary argument of loss of type information).
> Something like this would address an awful lot of gripes about trigger
> functions though.

I think the interesting bit (wrt the examples I've seen, that is) would
be to be able to use the TG_ARGS array as the element specifier. Not
sure if this is any different from your example. It's been some time
since I've been near this though, so maybe what I wanted is now possible
with USING tricks.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2010-11-09 20:05:45 Re: Protecting against unexpected zero-pages: proposal
Previous Message Alvaro Herrera 2010-11-09 19:57:49 Re: CREATE CONSTRAINT TRIGGER