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