Received: from mail.perdue.net (c696732-a.west1.ia.home.com [24.22.227.157]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f2EG40x32694 for ; Wed, 14 Mar 2001 11:04:00 -0500 (EST) (envelope-from tperdue@mail.perdue.net) Received: (from tperdue@localhost) by mail.perdue.net (8.11.2/8.11.2/Debian 8.11.2-1) id f2EG2lV12020; Wed, 14 Mar 2001 10:02:47 -0600 Date: Wed, 14 Mar 2001 10:02:47 -0600 From: Tim Perdue To: Bruce Momjian Cc: pgsql-sql@postgresql.org Subject: Re: PL/pgSQL "compilation error" Message-ID: <20010314100247.P670@mail.perdue.net> References: <20010314085635.O670@mail.perdue.net> <200103141533.KAA26366@candle.pha.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.12i In-Reply-To: <200103141533.KAA26366@candle.pha.pa.us>; from pgman@candle.pha.pa.us on Wed, Mar 14, 2001 at 10:33:49AM -0500 X-Archive-Number: 200103/277 X-Sequence-Number: 1936 On Wed, Mar 14, 2001 at 10:33:49AM -0500, Bruce Momjian wrote: > It is hard to test this without the table schema, but I think you are > missing some END IF's in the code above. Those are not elif's, but > actual new IF's that need their own END IF, I think. Oh wow - this is almost like going back to my COBOL days. IF NEW.status_id <> OLD.status_id THEN IF new.status_id = 1 THEN UPDATE artifact_counts_agg SET open_count=open_count+1 \ WHERE group_artifact_id=new.group_artifact_id; ELSE IF new.status_id = 2 THEN UPDATE artifact_counts_agg SET open_count=open_count-1 \ WHERE group_artifact_id=new.group_artifact_id; ELSE IF new.status_id = 3 THEN UPDATE artifact_counts_agg SET open_count=open_count-1,count=count-1 \ WHERE group_artifact_id=new.group_artifact_id; END IF; END IF; END IF; END IF; Yes - nesting those IFs did the trick. Are there more examples of PL/pgSQL anywhere beyond those on your website? Thanks, Bruce! Tim -- Founder - PHPBuilder.com / Geocrawler.com Lead Developer - SourceForge VA Linux Systems