Re: nested elseif woes

From: Frank Miles <fpm(at)u(dot)washington(dot)edu>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: nested elseif woes
Date: 2004-05-10 18:49:18
Message-ID: Pine.A41.4.58.0405101147080.110800@homer06.u.washington.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Ivan:

On Mon, 10 May 2004, Ivan Sergio Borgonovo wrote:

> First thanks to Tom Lane who helped me promptly.
>
> Now let's come to the problem:
>
> create or replace function testa( )
> returns char(32) as
> '
> begin
> if 1=2 then
> if 1=2 then
> select 1;
> elseif 1=3 then
> select 2;
> elseif 1=4 then
> if 1=5 then
> select 3;
> else
> select 4;
> end if;
> end if;
> end if;
> return md5(''aaaa'');
> end;
> ' language plpgsql;
>
> test1=# select * from testa();
> ERROR: syntax error at or near "if"
> CONTEXT: compile of PL/pgSQL function "testa" near line 14
>
> I made several test functions with similar structure with no
> improvements.
> I can't even figure a pattern. I get errors on if, else, and elseif.
> Till now the culprit seems to be elseif. Whenever I write test
> functions without elseif I get no errors.
> Did I misinterpreted the docs (37.7.2.4)?
>
> I really can't see the problem.
>
> I'm running 7.4.2-1 on Debian Sarge.

Is this the literal function? If so, try changing the "elseif" to "elsif".
No 2nd 'e'.

-frank

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Kris Jurka 2004-05-10 18:56:39 Re: nested elseif woes
Previous Message Pavel Stehule 2004-05-10 18:26:02 domain type and array, is it possible?