Re: pl/pgsql oddity

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: pl/pgsql oddity
Дата
Msg-id 41C15E4C.4070500@samurai.com
обсуждение исходный текст
Ответ на Re: pl/pgsql oddity  (Richard Huxton <dev@archonet.com>)
Ответы Re: pl/pgsql oddity
Список pgsql-general
Richard Huxton wrote:
> You want "elsif" - plpgsql isn't a hugely sophisticated language and its
> parser is having trouble there. I'm guessing the parser is somehow
> putting the "elseif" branch under the initial "then" so it never gets
> executed.

Indeed; the parser thinks an unrecognized keyword indicates the
beginning of a SQL statement: since the PL/PgSQL parser and the SQL
parser are completely separate, we need to do some guessing about what
constitutes a legal SQL statement. See the more detailed diagnose of the
problem here:

http://archives.postgresql.org/pgsql-bugs/2004-11/msg00297.php

There's a patch in that thread that provides better PL/PgSQL error
checking (which results in flagging this kind of code as invalid at
compile time). Some form of that patch will be in 8.1, as well as other
nice stuff like warning for unreachable code.

Tom also suggested just adding 'elseif' as an alternative for 'elsif'.
That sounds like it would be worth doing.

> Congratulations - I think you've found a bug. You can report it formally
> via the bugs mailing list

No need, this is a known issue.

-Neil

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

Предыдущее
От: "Joolz"
Дата:
Сообщение: Re: pl/pgsql oddity
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: pl/pgsql oddity