Re: Before/After Trigger User Switching

From: "Aasmund Midttun Godal" <postgresql(at)aasmund(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Aasmund Midttun Godal" <postgresql(at)aasmund(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Before/After Trigger User Switching
Date: 2003-08-20 20:33:43
Message-ID: 20030820203343.8271.qmail@one.kreator.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thank you for your quick reply!

I understand your point of view, however the fact remains that you want the
action to be done as though it was the DEFINER user that did it, and that
has not changed even thoug the function itself has finished?

regards,

aasmund.

Tom Lane writes:

> "Aasmund Midttun Godal" <postgresql(at)aasmund(dot)com> writes:
>> When an operation is done throug a SECURITY DEFINER style function and
>> causes a trigger the current_user depends on whether it is executed BEFORE
>> or AFTER. I currently run 7.3.2. I believe the BEFORE behavior is correct
>> while the AFTER behavior is wrong. A bug? already fixed?
>
> An AFTER trigger is not fired until the interactive statement is about
> to complete --- ie, after the SECURITY DEFINER function has returned.
> There has been previous discussion (inconclusive) about changing the
> time of invocation of AFTER triggers, but given the current timing this
> is the behavior I'd expect.
>
> regards, tom lane

Aasmund Midttun Godal

aasmund(at)godal(dot)com - http://godal.com
+47 40 45 20 46 - Leiv Tronstadsvei 2, NO-7051 Trondheim

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-08-20 20:41:32 Re: "SELECT IN" Still Broken in 7.4b
Previous Message Tom Lane 2003-08-20 20:32:19 Re: "SELECT IN" Still Broken in 7.4b