From: Tim Perdue <tim@perdue.net>
To: Bruce Momjian <pgman@candle.pha.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: PL/pgSQL "compilation error"
Date: Wed, 14 Mar 2001 10:02:47 -0600
Message-ID: <20010314100247.P670@mail.perdue.net> (raw)
In-Reply-To: <200103141533.KAA26366@candle.pha.pa.us>
References: <20010314085635.O670@mail.perdue.net>
<200103141533.KAA26366@candle.pha.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-docs@postgresql.org
Cc: tim@perdue.net, pgman@candle.pha.pa.us, pgsql-sql@postgresql.org
Subject: Re: PL/pgSQL "compilation error"
In-Reply-To: <20010314100247.P670@mail.perdue.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox