Re: string_to_array with an empty input string - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: string_to_array with an empty input string
Date
Msg-id 12434A65-2A0C-4680-B968-513BB96E9E10@kineticode.com
Whole thread Raw
In response to Re: string_to_array with an empty input string  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: string_to_array with an empty input string  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
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
usegenerate_subscripts(). 

Best,

David



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: string_to_array with an empty input string
Next
From: Andrew Dunstan
Date:
Subject: Re: string_to_array with an empty input string