On Aug 11, 2010, at 10:53 AM, Robert Haas wrote:
>> Iterating through an array with plpgsql, for example, is more clunky
>> than it should be.
>
> Really?
>
> FOR var IN SELECT UNNEST(arr) LOOP ... END LOOP
>
> I mean, doing everything is sort of clunky in PL/pgsql, but this
> doesn't seem particularly bad as PL/pgsql idioms go.
That tends to over-flatten if you have nested arrays and just want to iterate over the top level. In that case you must use generate_subscripts().
Best,
David