X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A1CA6D1B904 for ; Wed, 20 Aug 2003 17:12:39 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 85811-02 for ; Wed, 20 Aug 2003 17:12:30 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 0E7B2D1BA84 for ; Wed, 20 Aug 2003 17:12:28 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h7KKCR5H017712; Wed, 20 Aug 2003 16:12:27 -0400 (EDT) To: "Aasmund Midttun Godal" Cc: pgsql-sql@postgresql.org Subject: Re: Before/After Trigger User Switching In-reply-to: <20030820171250.15333.qmail@one.kreator.com> References: <20030820171250.15333.qmail@one.kreator.com> Comments: In-reply-to "Aasmund Midttun Godal" message dated "Wed, 20 Aug 2003 19:12:49 +0200" Date: Wed, 20 Aug 2003 16:12:27 -0400 Message-ID: <17711.1061410347@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/239 X-Sequence-Number: 14855 "Aasmund Midttun Godal" 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