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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
     subscribe-nomail command to [EMAIL PROTECTED] so that your
     message can get through to the mailing list cleanly

Reply via email to