Re: JOIN results of refcursor functions

From: Milan Oparnica <milan(dot)opa(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: JOIN results of refcursor functions
Date: 2008-11-27 20:27:51
Message-ID: ggmvnt$v5b$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
> Milan Oparnica <milan(dot)opa(at)gmail(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2008-11-27 20:45:09 Re: JOIN results of refcursor functions
Previous Message Pawel Socha 2008-11-25 22:07:43 Re: EXECUTE query INTO problem