Re: Trigger functions don't obey "strict" setting? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Trigger functions don't obey "strict" setting?
Date
Msg-id 26538.968451750@sss.pgh.pa.us
Whole thread Raw
In response to Trigger functions don't obey "strict" setting?  (Peter Eisentraut <peter_e@gmx.net>)
Responses Where to stick function setuid
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: "setuid" functions, a solution to the RI privilege problem
Next
From: Mike Mascari
Date:
Subject: I remember why I suggested CREATE FUNCTION...AS NULL