X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 27C239DCBAF for ; Fri, 24 Feb 2006 14:47:11 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75352-05-2 for ; Fri, 24 Feb 2006 14:47:10 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from matrix.gatewaynet.com (host2.dynacom.ondsl.gr [62.103.35.210]) by postgresql.org (Postfix) with ESMTP id 7ED9E9DC80C for ; Fri, 24 Feb 2006 14:47:08 -0400 (AST) Received: from matrix.gatewaynet.com (localhost.localdomain [127.0.0.1]) by matrix.gatewaynet.com (8.12.8/8.12.8) with ESMTP id k1OJpOOp020285; Fri, 24 Feb 2006 21:51:24 +0200 Received: from localhost (achill@localhost) by matrix.gatewaynet.com (8.12.8/8.12.8/Submit) with ESMTP id k1OJpOHV020281; Fri, 24 Feb 2006 21:51:24 +0200 Date: Fri, 24 Feb 2006 21:51:24 +0200 (EET) From: Achilleus Mantzios To: Tom Lane cc: Alvaro Herrera , Subject: Re: After Trigger assignment to NEW In-Reply-To: <4347.1140802671@sss.pgh.pa.us> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-7 Content-Transfer-Encoding: 8BIT X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200602/302 X-Sequence-Number: 24312 O Tom Lane έγραψε στις Feb 24, 2006 : > Alvaro Herrera writes: > > Tom Lane wrote: > >> Achilleus Mantzios writes: > >>> Is there a reason that the NEW values should remain unchanged in AFTER > >>> row triggers? > >> > >> By definition, an AFTER trigger is too late to change what was stored. > >> Use a BEFORE trigger. > > > But a BEFORE trigger would alter the stored tuple, which is not what > > Achilleus wants AFAIU. > > Oh, I misunderstood what he wanted ... and now that I do understand, > I think it's a really terrible idea :-(. A large part of the point > of using an AFTER trigger is to be certain you know exactly what got > stored. (BEFORE triggers can never know this with certainty because > there might be another BEFORE trigger that runs after them and edits the > tuple some more.) If one AFTER trigger could falsify the data seen by > the next, then that guarantee crumbles. For instance, a minor > programming error in a user-written trigger could break foreign-key > checking. No thanks. Alvaro, Tom, thanx a lot, i'll have to incorporate that into dbmirror. > > > I think the desired effect can be had by having DBMirror check the > > source relation of the inserted tuple (There is a hidden attributa > > called tableoid IIRC that can be used for that, I think). > > I agree --- the correct solution is to change the DBMirror triggers to > incorporate the desired filtering logic. > > regards, tom lane > -- -Achilleus