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

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to