X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9757453816 for ; Mon, 11 Apr 2005 17:27:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 64704-08 for ; Mon, 11 Apr 2005 20:27:36 +0000 (GMT) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by svr1.postgresql.org (Postfix) with ESMTP id 596315376D for ; Mon, 11 Apr 2005 17:27:35 -0300 (ADT) Received: from [192.168.0.2] ([24.201.88.196]) by VL-MO-MR007.ip.videotron.ca (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0IES009YDU4K1U@VL-MO-MR007.ip.videotron.ca> for pgsql-sql@postgresql.org; Mon, 11 Apr 2005 16:26:44 -0400 (EDT) Date: Mon, 11 Apr 2005 16:29:51 -0400 From: Carlos Moreno Subject: Update aborted if trigger function fails? To: pgsql-sql@postgresql.org Message-id: <425ADE3F.1090206@mochima.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200504/153 X-Sequence-Number: 21046 Hi, I just noticed this (odd?) behaviour, and it kind of scares me. For testing purposes, I put a deliberate syntax error; this wouldn't happen in a real-life situation. But what if the error gets triggered by something that happens later on? say, if the trigger function uses a field that later on gets dropped from the table -- something that was working fine all of a sudden produces syntax errors while executing the function (I just verified, to see if the server would let me drop a column that is being referenced by a function invoked by an active trigger, and it did let me drop it). Isn't this a little fragile? Is there something I could do to avoid this situation? Should trigger functions be extremely simple as to guarantee that an error would never happen? Thanks, Carlos --