From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Joolz <joolz(at)arbodienst-limburg(dot)nl> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: pl/pgsql oddity |
Date: | 2004-12-16 09:35:27 |
Message-ID: | 41C156DF.6090704@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Joolz wrote:
> Hello everyone,
>
> When writing some serverside code I ran into an oddity that I
> managed to boil down to this:
> elseif l >= 38 then
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. If you rewrite the function like so:
create or replace function fubar() returns varchar as '
declare
l integer;
begin
l = 34;
if l < 38 then
raise notice ''< 38: %'',l;
elseif l >= 38
then raise notice ''>= 38: %'',l;
else
raise notice ''this is not possible: %'',l;
end if;
return 0;
end;'
language 'plpgsql';
Now, try different values for "l" and you'll see what is happening.
Congratulations - I think you've found a bug. You can report it formally
via the bugs mailing list or http://www.postgresql.org/bugform.html
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Joolz | 2004-12-16 09:37:34 | Re: pl/pgsql oddity |
Previous Message | Richard Huxton | 2004-12-16 09:23:42 | Re: Insert do not work in my case |