Re: Accessing original TupleDesc from SRF - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Accessing original TupleDesc from SRF
Date
Msg-id 3D6F9303.9080608@joeconway.com
Whole thread Raw
In response to Accessing original TupleDesc from SRF  (John Gray <jgray@azuli.co.uk>)
List pgsql-hackers
Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>>Actually, I left off trying to figure out how to pass the columndef to 
>>ExecMakeFunctionResult in the first place.
> 
> That was hard yesterday, but it's easy today because nodeFunctionscan
> isn't using ExecEvalExpr anymore --- we'd only have to add one more
> parameter to ExecMakeTableFunctionResult and we're there.

I didn't even realize you had changed that! Things move quickly around 
here ;-). I'll take a look this morning.


>>Preference of extending FunctionCallInfoData or ReturnSetInfo?
> 
> Definitely ReturnSetInfo.  If we put it in FunctionCallInfoData then
> that's an extra word to zero for *every* fmgr function call, not only
> table functions.

OK.


> One thing to notice is that a table function that's depending on this
> info being available will have to punt if it's invoked via
> ExecMakeFunctionResult (ie, it's being called in a SELECT targetlist).
> That doesn't bother me too much, but maybe others will see it
> differently.

It's an important safety tip, but it doesn't bother me either. I think 
you have suggested before that SRFs in SELECT targetlists should be 
deprecated/removed. I'd take that one step further and say that SELECT 
targetlists should only allow a scalar result, but obviously there are 
some backwards compatibility issues there.

Joe




pgsql-hackers by date:

Previous
From: "Iavor Raytchev"
Date:
Subject: pgaccess - where to store the own data
Next
From: Alvaro Herrera
Date:
Subject: Re: contrib features during beta period