From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Richard Huxton <dev(at)archonet(dot)com> |
Cc: | Joolz <joolz(at)arbodienst-limburg(dot)nl>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: pl/pgsql oddity |
Date: | 2004-12-16 10:07:08 |
Message-ID: | 41C15E4C.4070500@samurai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2004-12-16 10:46:27 | Re: pl/pgsql oddity |
Previous Message | Joolz | 2004-12-16 10:04:47 | Re: pl/pgsql oddity |