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 types required for setof.

Is there any function I could use to retrieve the SQL command from named 
 bound cursor from inside another function ?


Idea:

a. I declare a refcursor function "C1Ref" as select...from 

b. In the new function (also of refcursor type) where I want to join 
C1Ref to something I replace the C1Ref call with SQL query text of that 
cursor (simply as a subquery).


For this to work I must have a way to get C1Ref cursors SQL text in the 
new function.


If possible, please give a small example because I'm quite new to PG and 
I still find very few examples on the web. PG is excellent, but I can't 
navigate through the documentation well.


Thanks,

Milan Oparnica

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


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 types required for setof.

Then use OUT variables.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql