On Thu, Nov 19, 2009 at 12:15 PM, Scott Bailey <artacus@comcast.net> wrote:
>> FROM generate_series(array_lover($1,1),array_upper($1,1)) g(i)
>
> Pavel,
>
> Don't get me wrong, I enjoy coding, but I think you've taken it too far here
> ;)
>
> Yes, definitely more effective for large arrays. Thanks. Would probably be a
> good snippet for the wiki.
this was actually a pretty typical solution to dealing with arrays
until we got 'unnest()'. See information_schema._pg_expand_array for
example.
I need this functionality quite often...maybe we could use a version
of unnest that works like that (returns idx, elem)? It would be a
small efficiency win over generate_series based approaches.
merlin