Re: Trigger execution role

2021-02-16 Thread Andrew Dunstan
On 2/16/21 3:59 PM, Isaac Morland wrote: > On Fri, 12 Feb 2021 at 12:58, Tom Lane > wrote: > > Isaac Morland > writes: > > I was trying to use triggers, and ran into something I hadn't > realized > > until now: trigg

Re: Trigger execution role

2021-02-16 Thread Isaac Morland
On Fri, 12 Feb 2021 at 12:58, Tom Lane wrote: > Isaac Morland writes: > > I was trying to use triggers, and ran into something I hadn't realized > > until now: triggers run, not as the owner of the table, but as the user > who > > is doing the insert/update/delete. > > If you don't want that, yo

Re: Trigger execution role

2021-02-12 Thread Tom Lane
Isaac Morland writes: > I was trying to use triggers, and ran into something I hadn't realized > until now: triggers run, not as the owner of the table, but as the user who > is doing the insert/update/delete. If you don't want that, you can make the trigger function SECURITY DEFINER. If we forc

Trigger execution role

2021-02-12 Thread Isaac Morland
I was trying to use triggers, and ran into something I hadn't realized until now: triggers run, not as the owner of the table, but as the user who is doing the insert/update/delete. It seems to me that for a lot of the suggested uses of triggers this is not the desired behaviour. For example, in t