Why is fncollation in FunctionCallInfoData rather than fmgr_info? - Mailing list pgsql-hackers

From Andres Freund
Subject Why is fncollation in FunctionCallInfoData rather than fmgr_info?
Date
Msg-id 20180605205747.5dewfi3oobk3sw3p@alap3.anarazel.de
Whole thread Raw
Responses Re: Why is fncollation in FunctionCallInfoData rather than fmgr_info?
Re: Why is fncollation in FunctionCallInfoData rather than fmgr_info?
List pgsql-hackers
Hi,

In my understanding FunctionCallInfoData is basically per-call data,
whereas FmgrInfo is information about the function.  It makes some sense
that ->context is in FunctionCallInfoData, after all it's used for
per-row data like the trigger context.  But we don't really change the
collation of function invocations per-call.  Thus I don't quite get why
FunctionCallInfoData contains information about it rather than FmgrInfo.

Now I get that there's the practical reason that we want to pass the
collation to function invocations made with DirectionFunctionCall*Coll,
and they currently don't set up a FmgrInfo.  But that doesn't really
convince me this is a good idea.

The reason I'm asking is that I'm fixing the JIT code generation for
expressions to be more efficient. And for functions that do not get
inlined I currently need to set up a separate *per-call*
FunctionCallInfoData to allow the optimizer to be free enough to do it's
thing.  And the less metadata has to be copied around, the better.  I'm
not sure it's realistic to change this, I mostly want to understand the
reasoning.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Ashwin Agrawal
Date:
Subject: Re: Recovery performance of DROP DATABASE with many tablespaces
Next
From: Chapman Flack
Date:
Subject: Re: Why is fncollation in FunctionCallInfoData rather than fmgr_info?