Received: from nts1.rtp.epa.gov (nts1.rtp.epa.gov [134.67.208.208]) by hub.org (8.10.1/8.10.1) with ESMTP id e73FUbG70375 for ; Thu, 3 Aug 2000 11:30:37 -0400 (EDT) Received: from epamail.epa.gov (IDENT:mvs@wolfpack.rtpnc.epa.gov [134.67.139.59]) by nts1.rtp.epa.gov (8.9.3/8.9.3) with ESMTP id LAA31345 for ; Thu, 3 Aug 2000 11:34:21 -0400 (EDT) Message-ID: <39899013.AA9243EC@epamail.epa.gov> Date: Thu, 03 Aug 2000 11:30:27 -0400 From: Mark Volpe X-Mailer: Mozilla 4.74 [en] (X11; U; Linux 2.2.14-15mdk i586) X-Accept-Language: en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: PL/pgSQL evaluation order Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200008/26 Hi, I have trigger function with the statement: IF TG_OP=''INSERT'' OR NEW.ip!=OLD.ip THEN expecting the TG_OP=''INSERT'' to be evaluated first, and if true, proceed with the body. But it gets evaluated as the result of an INSERT statement, I get a (rather strangly worded) error: ERROR: record old is unassigned yet which means that the second statement is still being evaluated even though the first is true. Assuming that this is the result of the parser/planner messing with that statement, is there a way to force evaluation order without having to go: IF TG_OP=''INSERT'' THEN ELSE IF NEW.OP!=OLD.ip THEN END IF; END IF; Thanks, Mark