From: | Oliver Elphick <olly(at)lfix(dot)co(dot)uk> |
---|---|
To: | Roland Roberts <roland(at)astrofoto(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plpgsql trigger parse error |
Date: | 2002-09-11 15:14:53 |
Message-ID: | 1031757293.2065.452.camel@linda |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 2002-09-11 at 15:46, Roland Roberts wrote:
> is fine. The full function gives me a different error,
>
> NOTICE: plpgsql: ERROR during compile of deepsky_nodups near line 20
> ERROR: parse error at or near ";"
>
> Here is the full function:
>
> create function deepsky_nodups() returns opaque as '
> begin
> if (NEW.suffix is NULL and NEW.component is NULL) then
> if (exists (select id from deepsky where catalog = NEW.catalog and entry = NEW.entry and suffix is null and component is null)) then
> return NULL;
> end if;
> else if (NEW.component is NULL) then
> if (exists (select id from deepsky where catalog = NEW.catalog and entry = NEW.entry and suffix = NEW.suffix and component is null)) then
> return NULL;
> end if;
> else if (NEW.suffix is NULL) then
> if (exists (select id from deepsky where catalog = NEW.catalog and entry = NEW.entry and component = NEW.component and suffix is null)) then
> return NULL;
> end if;
> else
> if (exists (select id from deepsky where catalog = NEW.catalog and entry = NEW.entry and component = NEW.component and suffix = NEW.suffix)) then
> return NULL;
> end if;
> end if;
> return NEW;
> end;
> ' language 'plpgsql';
>
> What am I missing?
Using ELSE IF requires an extra END IF;
Use ELSIF instead.
--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"I am crucified with Christ; nevertheless I live; yet
not I, but Christ liveth in me; and the life which I
now live in the flesh I live by the faith of the Son
of God, who loved me, and gave himself for me."
Galatians 2:20
From | Date | Subject | |
---|---|---|---|
Next Message | Roland Roberts | 2002-09-11 15:17:11 | Re: plpgsql trigger parse error |
Previous Message | Darren Ferguson | 2002-09-11 15:11:46 | Re: plpgsql trigger parse error |