Re: set returning functions.

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>, "Rhys Stewart" <rhys(dot)stewart(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: set returning functions.
Date: 2007-09-25 15:53:51
Message-ID: b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 9/25/07, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2007/9/25, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>:
> > On 9/24/07, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> > > 2007/9/25, Rhys Stewart <rhys(dot)stewart(at)gmail(dot)com>:
> > > > yes indeed. thats exactly it scott!!!
> > > >
> > > > On 9/24/07, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> wrote:
> > > > > On 9/24/07, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> > > > > > Hello Rhys
> > > > > >
> > > > > > its not mystery
> > > > >
> > > > > Yeah, but I think he wanted to be able to make his own function he
> > > > > could call like:
> > > > >
> > > > > select myfunc(10);
> > > > >
> > >
> > > Then you have to use sql language
> > >
> > > create or replace function mysrf(int)
> > > returns setof integer as $$
> > > select i from generate_series(1, $1) g(i);
> > > $$ language sql;
> >
> > Do you HAVE to use sql plsql to get this to work? I thought that all
> > pl languages worked like this with pgsql.
> >
>
> if you can call SRF function in normal context (like SELECT srf()),
> you have to use SQL language

You can also do this in a C function also. you can always wrap your
plpgsql function in an sql function and sneak around the problem.
That said, it would be extremely nice if pl/pgsql functions could work
this way.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dan99 2007-09-25 15:59:55 Re: PG_DUMP not working
Previous Message Michael Glaesemann 2007-09-25 15:50:01 Re: Porblems migrating a server.