Re: [BUGS] set returning function

2005-05-09 Thread Tom Lane
Dennis Bjorklund <[EMAIL PROTECTED]> writes: > Is >SELECT 42, srf(); > the same as >SELECT 42, * FROM srf(); > ? No. > In my view the first version is an error. It's not like you can put a > normal table in the select list, so why can we put a set returning > function there? Ie, is it rea

Re: [BUGS] set returning function

2005-05-09 Thread Dennis Bjorklund
On Mon, 9 May 2005, Tom Lane wrote: > > Bug? > > Unimplemented feature. Is SELECT 42, srf(); the same as SELECT 42, * FROM srf(); ? In my view the first version is an error. It's not like you can put a normal table in the select list, so why can we put a set returning function there?

Re: [BUGS] set returning function

2005-05-09 Thread Tom Lane
Dennis Bjorklund <[EMAIL PROTECTED]> writes: > 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. Yup. > Bug? Unimplemented feature. regards, tom lane ---(end of

Re: [BUGS] set returning function

2005-05-09 Thread Kris Jurka
On Mon, 9 May 2005, Dennis Bjorklund wrote: > [ I can call sql or C SRFs without FROM, but not plpgsql.] Trying this in pltcl (while knowing nothing about tcl and the docs not mentioning any srf support) shows: CREATE FUNCTION tclset() RETURNS SETOF int AS 'return 0' LANGUAGE pltcl; SELECT *

[BUGS] set returning function

2005-05-09 Thread Dennis Bjorklund
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;