X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4883B8B9ED8 for ; Fri, 11 Feb 2005 01:49:00 +0000 (GMT) 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 21627-05 for ; Fri, 11 Feb 2005 01:48:41 +0000 (GMT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id C37B88B9EF6 for ; Fri, 11 Feb 2005 01:48:42 +0000 (GMT) Received: (qmail invoked by alias); 11 Feb 2005 01:48:41 -0000 Received: from dsl-082-082-232-211.arcor-ip.net (EHLO colt.pezone.net) (82.82.232.211) by mail.gmx.net (mp014) with SMTP; 11 Feb 2005 02:48:41 +0100 X-Authenticated: #495269 From: Peter Eisentraut To: "Guy Rouillier" Subject: Re: Pgsql conditions do not short circuit? Date: Fri, 11 Feb 2005 02:48:41 +0100 User-Agent: KMail/1.7.1 Cc: "PostgreSQL Interfaces" References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502110248.41720.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/45 X-Sequence-Number: 5290 Guy Rouillier wrote: > I have the following condition in a trigger function: > > IF (TG_OP = 'INSERT') OR (TG_OP = 'UPDATE' AND NEW.aggregate_flag > != OLD.aggregate_flag) > > When I cause this trigger to execute on an insert, it complains that > OLD is not defined yet. If I reformat this so I check the last > condition in an IF nested in the "UPDATE" case, it works fine. From > this, I'm concluding that pgsql conditions do not short circuit? That is true, but it wouldn't have helped you anyway, because the error is caught during the semantic analysis before the execution phase. -- Peter Eisentraut http://developer.postgresql.org/~petere/