From: | Tim Perdue <tim(at)perdue(dot)net> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: PL/pgSQL "compilation error" |
Date: | 2001-03-14 16:02:47 |
Message-ID: | 20010314100247.P670@mail.perdue.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-docs pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-03-14 16:06:20 | Re: [SQL] PL/pgSQL "compilation error" |
Previous Message | Tom Lane | 2001-03-14 15:52:03 | Re: PL/pgSQL "compilation error" |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-03-14 16:06:20 | Re: [SQL] PL/pgSQL "compilation error" |
Previous Message | Tom Lane | 2001-03-14 15:52:03 | Re: PL/pgSQL "compilation error" |