Peter Eisentraut <peter_e@gmx.net> writes:
> I just read across the code in command/trigger.c:ExecCallTriggerFunc() and
> apparently the trigger function is called unconditionally even if the
> "strict" flag is set. Perhaps this should be amended somewhere.
Since triggers take no parameters, I'm not sure this is wrong. But if
it is wrong, then the code at fault is ExecCallTriggerFunc, not
FunctionCallInvoke. FunctionCallInvoke is just for *invoking*, not
for deciding whether to invoke.
> Btw., FunctionCallInvoke() would look to be the most prominent place to
> hook in the "setuid" feature. For that purpose I'd make the macro an
> inline function instead.
Ugh. The performance cost would be excessive. Instead, when fmgr is
setting up to call a setuid function, have it insert an extra level of
function handler that does the save/setup/restore of current UID.
That way, the cost is zero when you're not using the feature (which is
nearly always).
regards, tom lane