Thread: [GENERAL][SQL] Functions with composite resutl-set

[GENERAL][SQL] Functions with composite resutl-set

From
Herve Lefebvre
Date:
Hi all,

I've a function who retrieves multiple columns:

CREATE FUNCTION myfunc() RETURNS SETOF mytable
AS 'SELECT a,b,c FROM mytable;' LANGUAGE 'sql';

When I call it, I cannot retrieve all columns without
executing 3 times the function.

select myfunc() does not work

select a(myfunc()), b(myfunc()), c(myfunc()) works but executes 3
times the function.

I've tried
select *(mynfunc())
select all(myfunc())
select myfunc()::mytable
select myfunc()::mytable.*
...

But i've a syntax error on each of these.

Any help ? Thanks.

--
Herve LEFEBVRE




_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com