Stephen Frost <sfrost@snowman.net> writes:
> As I understood Mark's suggestion, the trigger would run but would have
> the privileges of the intersection of both user's permissions, which is
> an interesting idea but not one we've got any way to really do today as
> each privilege check would now need to check two different roles for
> privilege- and if one of the privilege checks fails, then what..?
> Presumably there would be an ERROR returned, meaning that the operation
> would be able to be prevented from happening by the trigger author,
> which was objected to as not being acceptable either, per below.
I've not been paying close attention, so maybe this was already
considered, but ...
What if we allow event triggers owned by non-superusers, but only fire
them on commands performed by the trigger's owner? This sidesteps all
the issues of who has which privileges and whether Alice is malicious
towards Bob or vice versa, because there is no change of privilege
domain. Admittedly, it fails to cover some use-cases, but I think it
would still handle a lot of interesting cases. The impression I have
is that a lot of applications do everything under just one or a few
roles.
Possibly this could be generalized to "fire on commands performed by
any role the trigger owner is a member of", but then I'm a bit less
sure that it's safe from both roles' perspectives.
regards, tom lane