Re: final patch - plpgsql: for-in-array - Mailing list pgsql-hackers

From Tom Lane
Subject Re: final patch - plpgsql: for-in-array
Date
Msg-id 12307.1290119376@sss.pgh.pa.us
Whole thread Raw
In response to Re: final patch - plpgsql: for-in-array  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: final patch - plpgsql: for-in-array
List pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2010/11/18 Alvaro Herrera <alvherre@commandprompt.com>:
>> I fail to see how this supports the FOR-IN-array development though.  It
>> will just be another unused construct for most people, no?

> maybe I don't understand well, but patch FOR-IN-ARRAY has a documentation

UNNEST is documented too.  Adding still more features doesn't really
improve matters for people who haven't memorized the documentation;
it only makes it even harder for them to find out what they should be
using.  (More features != better)

To my mind, the complaint about subscripting being slow suggests that we
ought to fix subscripting, not introduce a nonstandard feature that will
make certain use-cases faster if people rewrite their code to use it.

I think it would probably not be terribly hard to arrange forcible
detoasting of an array variable's value the first time it gets
subscripted, for instance.  Of course that only fixes some use-cases;
but it would help, and it helps without requiring people to change their
code.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Latches with weak memory ordering (Re: max_wal_senders must die)
Next
From: Andres Freund
Date:
Subject: Re: final patch - plpgsql: for-in-array