Re: [SQL] JOIN results of refcursor functions

2008-12-02 Thread Milan Oparnica
Milan Oparnica wrote: Then I've tried: CREATE FUNCTION foo(insklid int, out sklid int, out elid INT) RETURNS SETOF record AS $$ BEGIN RETURN QUERY SELECT sklid,elid FROM skladkol; RETURN; END; $$ LANGUAGE plpgsql; but it returns 5498 rows (which is exact number of rows in that table) bu

Re: [SQL] JOIN results of refcursor functions

2008-12-01 Thread Pavel Stehule
> > Then I've tried: > > CREATE FUNCTION foo(insklid int, out sklid int, out elid INT) RETURNS SETOF > record AS $$ > BEGIN >RETURN QUERY SELECT sklid,elid FROM skladkol; >RETURN; > END; > $$ LANGUAGE plpgsql; know bug :( - your variable names are in collision with column names. You have t

Re: [SQL] JOIN results of refcursor functions

2008-12-01 Thread Milan Oparnica
Alvaro Herrera wrote: Milan Oparnica escribió: I've searched documentation (8.3) and didn't find a way to use OUT variables in same manner as SETOF (RETURN NEXT doesn't create a record type result). Can you please give an example of how to return select fld1, fld2 from table through OUT

Re: [SQL] JOIN results of refcursor functions

2008-11-30 Thread Alvaro Herrera
Milan Oparnica escribió: > I've searched documentation (8.3) and didn't find a way to use OUT > variables in same manner as SETOF (RETURN NEXT doesn't create a record > type result). > > Can you please give an example of how to return select fld1, fld2 from > table through OUT variables so t

Re: [SQL] JOIN results of refcursor functions

2008-11-30 Thread Milan Oparnica
Alvaro Herrera wrote: Milan Oparnica escribió: Tom Lane wrote: Milan Oparnica <[EMAIL PROTECTED]> writes: Is there any way to use INNER, LEFT and RIGHT JOIN between functions returning refcursor type. No. Make them return setof whatever instead. I would like yo avoid creating custom compo

Re: [SQL] JOIN results of refcursor functions

2008-11-27 Thread Alvaro Herrera
Milan Oparnica escribió: > Tom Lane wrote: >> Milan Oparnica <[EMAIL PROTECTED]> writes: >>> Is there any way to use INNER, LEFT and RIGHT JOIN between functions >>> returning refcursor type. >> >> No. Make them return setof whatever instead. >> > I would like yo avoid creating custom composite

Re: [SQL] JOIN results of refcursor functions

2008-11-27 Thread Milan Oparnica
Tom Lane wrote: Milan Oparnica <[EMAIL PROTECTED]> writes: Is there any way to use INNER, LEFT and RIGHT JOIN between functions returning refcursor type. No. Make them return setof whatever instead. regards, tom lane I would like yo avoid creating custom composite t

Re: [SQL] JOIN results of refcursor functions

2008-11-21 Thread Tom Lane
Milan Oparnica <[EMAIL PROTECTED]> writes: > Is there any way to use INNER, LEFT and RIGHT JOIN between functions > returning refcursor type. No. Make them return setof whatever instead. regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To

[SQL] JOIN results of refcursor functions

2008-11-21 Thread Milan Oparnica
Hi, Is there any way to use INNER, LEFT and RIGHT JOIN between functions returning refcursor type. Explain: function1 as refcursor function2 as refcursor both functions return columns a and b. can i join the results of these functions in such manner (or any other): function3 as refcursor