nested elseif woes

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема nested elseif woes
Дата
Msg-id 20040510193007.66215b18@stige.webthatworks.it
обсуждение исходный текст
Ответы Re: nested elseif woes  (Frank Miles <fpm@u.washington.edu>)
Re: nested elseif woes  (Kris Jurka <books@ejurka.com>)
Re: nested elseif woes  (Ron St-Pierre <rstpierre@syscor.com>)
Список pgsql-general
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.


To be less annoying to the list, could anyone point me to somewhere
where I could look at functions written by others.
Any good project with enough complicated functions to be useful to
learn.


thx

В списке pgsql-general по дате отправления:

Предыдущее
От: Jack Orenstein
Дата:
Сообщение: Re: basic question (shared buffers vs. effective cache
Следующее
От: "Ed L."
Дата:
Сообщение: Re: Interpreting vacuum verbosity