Why is fncollation in FunctionCallInfoData rather than fmgr_info?

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Why is fncollation in FunctionCallInfoData rather than fmgr_info?
Date: 2018-06-05 20:57:47
Message-ID: 20180605205747.5dewfi3oobk3sw3p@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Sven R. Kunze 2018-06-05 21:06:48 Re: Code of Conduct plan
Previous Message Jonathan S. Katz 2018-06-05 20:30:10 Re: Code of Conduct plan