| From: | Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> |
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org |
| Cc: | airbaggins(at)yahoo(dot)co(dot)uk |
| Subject: | set returning function |
| Date: | 2005-05-09 10:21:05 |
| Message-ID: | Pine.LNX.4.44.0505091208380.7072-100000@zigo.dhs.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
An issue came up on irc. How come that this work:
SELECT generate_series(0,1);
but
SELECT foo(0,1);
does not, where foo is my own set returning function, like this example:
CREATE FUNCTION foo(a int, b int)
RETURNS setof int
AS 'BEGIN RETURN NEXT a;
RETURN NEXT b;
RETURN;
END'
LANGUAGE plpgsql;
As far as I can tell the generate_series() example is not supposed to
work either.
Kris Jurka showed me another example that do work in the same way as
generate_series:
CREATE FUNCTION bar(int, int)
RETURNS setof int
AS 'SELECT $1 UNION ALL SELECT $2;'
LANGUAGE sql;
So it seems that it's not just the type that decide how the function can
be used, it's also the language the function is defined in.
Bug?
--
/Dennis Björklund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Kris Jurka | 2005-05-09 10:55:48 | Re: set returning function |
| Previous Message | Dave Page | 2005-05-09 07:27:03 | Re: BUG #1654: can't run SQL commands |