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
andcomponent 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.suffixand 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.componentand 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.componentand 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.Elphick@lfix.co.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