pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Merlin Moncure <mmoncure@gmail.com>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Scott Marlowe <scott.marlowe@gmail.com>
Cc: Rhys Stewart <rhys.stewart@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: set returning functions.
Date: Tue, 25 Sep 2007 11:53:51 -0400
Message-ID: <b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com> (raw)
In-Reply-To: <162867790709250729y2498a494pce31cbd49042ef95@mail.gmail.com>
References: <189966030709211129t7147b726w25f415489f25b874@mail.gmail.com>
	<162867790709241509k16bbe691v94c9ef2748fbbba@mail.gmail.com>
	<dcc563d10709241601y785a6c77r28a349d204b3e2d4@mail.gmail.com>
	<189966030709241618p1f104e2ep55a9f8f5725ef90@mail.gmail.com>
	<162867790709242146m70791358gfe2a9045b6512ece@mail.gmail.com>
	<dcc563d10709250712l147b651egdc0157f7ad01e6cb@mail.gmail.com>
	<162867790709250729y2498a494pce31cbd49042ef95@mail.gmail.com>

On 9/25/07, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> 2007/9/25, Scott Marlowe <scott.marlowe@gmail.com>:
> > On 9/24/07, Pavel Stehule <pavel.stehule@gmail.com> wrote:
> > > 2007/9/25, Rhys Stewart <rhys.stewart@gmail.com>:
> > > > yes indeed. thats exactly it scott!!!
> > > >
> > > > On 9/24/07, Scott Marlowe <scott.marlowe@gmail.com> wrote:
> > > > > On 9/24/07, Pavel Stehule <pavel.stehule@gmail.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



view thread (9+ messages)

Message-ID: <b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com>
Permalink:  ../b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com/
Also on:    postgresql.org/message-id/b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-general@postgresql.org
  Cc: mmoncure@gmail.com, pavel.stehule@gmail.com, scott.marlowe@gmail.com, rhys.stewart@gmail.com
  Subject: Re: set returning functions.
  In-Reply-To: <b42b73150709250853h47363f93j2e8f7426917c98d0@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox