SRF related and other questions - Mailing list pgsql-hackers

From Katsaros Kwn/nos
Subject SRF related and other questions
Date
Msg-id 000001c4cf27$417dbc90$e3fffbc3@NTINOAS
Whole thread Raw
Responses Re: SRF related and other questions
List 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

pgsql-hackers by date:

Previous
From: "Brusser, Michael"
Date:
Subject: Re: Relation does not exist
Next
From: Joe Conway
Date:
Subject: Re: SRF related and other questions