Re: JOIN results of refcursor functions - Mailing list pgsql-sql

From Milan Oparnica
Subject Re: JOIN results of refcursor functions
Date
Msg-id ggmvnt$v5b$1@news.hub.org
Whole thread Raw
In response to Re: JOIN results of refcursor functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: JOIN results of refcursor functions
List pgsql-sql
Tom Lane wrote:
> Milan Oparnica <milan.opa@gmail.com> 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 <table>

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


pgsql-sql by date:

Previous
From: "Pawel Socha"
Date:
Subject: Re: EXECUTE query INTO problem
Next
From: Alvaro Herrera
Date:
Subject: Re: JOIN results of refcursor functions