On 8/1/07, Decibel! <[EMAIL PROTECTED]> wrote:
> David Fetter and I just came up with these, perhaps others will find
> them useful:
>
> CREATE OR REPLACE FUNCTION array_to_set(anyarray, int) RETURNS SETOF 
> anyelement LANGUAGE SQL AS $$
>     SELECT $1[i] from generate_series(array_lower($1, $2), array_upper($1, 
> $2)) i
> $$;
> CREATE OR REPLACE FUNCTION array_to_set(anyarray) RETURNS SETOF anyelement 
> LANGUAGE SQL AS $$
>     SELECT array_to_set($1, 1)
> $$;

very nice, although IMO there is a strong justification for these
functions to be in core and written in C for efficiency (along with
array_accum, which I have hand burn from copying and pasting out of
the documentation).

merlin

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to