pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tim Perdue <tim@perdue.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: PL/pgSQL "compilation error"
Date: Wed, 14 Mar 2001 10:33:49 -0500 (EST)
Message-ID: <200103141533.KAA26366@candle.pha.pa.us> (raw)
In-Reply-To: <20010314085635.O670@mail.perdue.net>

>       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;
>    RETURN NEW;

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.


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026



view thread (13+ messages)  latest in thread

Message-ID: <200103141533.KAA26366@candle.pha.pa.us>
Permalink:  ../200103141533.KAA26366@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200103141533.KAA26366@candle.pha.pa.us

 · 

reply

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: pgman@candle.pha.pa.us, tim@perdue.net, pgsql-sql@postgresql.org
  Subject: Re: PL/pgSQL "compilation error"
  In-Reply-To: <200103141533.KAA26366@candle.pha.pa.us>

* 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