View Single Post

   
  #3 (permalink)  
Old 04-15-2008, 10:28 PM
Pavel Stehule
 
Posts: n/a
Default Re: Proposal: generate_iterator functions

2007/10/18, Merlin Moncure <mmoncure@gmail.com>:
> On 10/18/07, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> > this function can help with array's iteration.
> >
> > create function generate_iterator(anyarray)
> > returns setof integer
> > as $$
> > select i
> > from generate_series(array_lower($1,1),
> > array_upper($1,1)) g(i)
> > $$ language sql;

>
> There was a very similar proposal a little while back (google:
> array_to_set). I think I like those names better since you are
> returning a set, not an iterator :-). Also, this should be internal
> as you suggest (there is an undocumented builtin that already does
> this, _pg_expandarray).
>

I remember. There is only one important difference. What is behave of
array_to_set with multidim. array? the name "generate_iterator" is my
first idea (it retunrs set but setof indexes). I am sure so there are
better names
Pavel

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Reply With Quote