SRF related and other questions

From: "Katsaros Kwn/nos" <ntinos(at)aueb(dot)gr>
To: pgsql-hackers(at)postgresql(dot)org
Subject: SRF related and other questions
Date: 2004-11-20 16:50:30
Message-ID: 000001c4cf27$417dbc90$e3fffbc3@NTINOAS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

First, I have the following question on Set Returning Functions:

Regarding the return type, there are two ways of defining it:

Either set it to: "setof _some_predifined_type"
or
set it to: "setof records" and then define the expected results with "as(attr1 type, ..., attr_n type)".

Right?

If these are indeed the only ways, is it possible to write an SRF whose return type is defined inside the code (something like the second way mentioned above but altering TupleDesc or something like that?) based on the executed query?
What I want to do is to write an SRF, which will execute a query maybe different than (but derived from) the original one passed to this function. Obviously the first way is not suitable since I cannot know a priori (before entering my SRF) what the result type will exactly be.

In general, (having the Query/Plan etc. available) are there any functions (or anything) that could help defining the type of the expected results?
A solution I suppose would be to parse the Query but in this case I would like to know if there are any functions that would help create the TupleDesc and anything else requiered.

Second, could you please tell me where in the code an incoming request, from a remote dblink_record() call, is handled? I'm a little lost here :-)

Regards,
Ntinos Katsaros

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-11-20 16:53:31 Re: New compile warnings
Previous Message Richard Huxton 2004-11-20 16:19:50 Re: Fwd: SELECT MAX with char => BUG?