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 5D973D1BB52 for ; Wed, 20 Aug 2003 17:33:56 -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 89611-09 for ; Wed, 20 Aug 2003 17:33:45 -0300 (ADT) Received: from one.kreator.com (one.kreator.com [213.187.162.222]) by svr1.postgresql.org (Postfix) with SMTP id 5B46BD1BA46 for ; Wed, 20 Aug 2003 17:33:42 -0300 (ADT) Received: (qmail 10026 invoked by uid 1000); 20 Aug 2003 20:33:43 -0000 Message-ID: <20030820203343.8271.qmail@one.kreator.com> References: <20030820171250.15333.qmail@one.kreator.com> <17711.1061410347@sss.pgh.pa.us> In-Reply-To: <17711.1061410347@sss.pgh.pa.us> From: "Aasmund Midttun Godal" To: Tom Lane Cc: "Aasmund Midttun Godal" , pgsql-sql@postgresql.org Subject: Re: Before/After Trigger User Switching Date: Wed, 20 Aug 2003 22:33:43 +0200 Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/243 X-Sequence-Number: 14859 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" 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@godal.com - http://godal.com +47 40 45 20 46 - Leiv Tronstadsvei 2, NO-7051 Trondheim