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