Re: obtaining ARRAY position for a given match - Mailing list pgsql-general

From Merlin Moncure
Subject Re: obtaining ARRAY position for a given match
Date
Msg-id b42b73150911190943w4ffc2b2bk38fef13239b61d9e@mail.gmail.com
Whole thread Raw
In response to Re: obtaining ARRAY position for a given match  (Scott Bailey <artacus@comcast.net>)
Responses Re: obtaining ARRAY position for a given match  (Scott Bailey <artacus@comcast.net>)
Re: obtaining ARRAY position for a given match  (Sam Mason <sam@samason.me.uk>)
List pgsql-general
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

pgsql-general by date:

Previous
From: Scott Bailey
Date:
Subject: Re: obtaining ARRAY position for a given match
Next
From: Scott Bailey
Date:
Subject: Re: obtaining ARRAY position for a given match