From: | pgsql-bugs(at)postgresql(dot)org |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Bug #842: pgplsql: IF-THEN-ELSIF-ELSE acts different from IF-THEN-ELSE IF |
Date: | 2002-12-09 15:34:56 |
Message-ID: | 20021209153456.EC4CC475BEC@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Jrn Cornelius Olsen (jco(at)cornelius-olsen(dot)dk) reports a bug with a severity of 4
The lower the number the more severe it is.
Short Description
pgplsql: IF-THEN-ELSIF-ELSE acts different from IF-THEN-ELSE IF
Long Description
1) The 'boolean-expression' after 'ELSIF' always evaluates to FALSE. According to the manual IF-THEN-ELSIF-ELSE should be formally equivalent to IF-THEN-ELSE-IF-THEN, yet the example code below shows differently.
2) Also: There is no parse error if one omits 'THEN' after 'ELSIF boolean-expression' which leads me to believe that ELSIF has never been implemented. Yet there is not warning or error message nor any notices in the documentation.
Apart from the above: Thanks for a great SQL!
Sample Code
*** For the record ***
select version();
version
-------------------------------------------------------------
PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled by GCC 2.96
(1 row)
*** Demonstration ***
> create function demo1() returns integer as '
begin
if false then
return 1;
elsif true then
return 2;
else
return 3;
end if;
end;' language 'plpgsql';
> select demo1();
demo1
-------
3
(1 row)
create function demo2() returns integer as '
begin
if false then
return 1;
else
if true then
return 2;
else
return 3;
end if;
end if;
end;' language 'plpgsql';
> select demo2();
demo2
-------
2
(1 row)
No file was uploaded with this report
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-12-09 16:12:19 | Re: Bug #842: pgplsql: IF-THEN-ELSIF-ELSE acts different from IF-THEN-ELSE IF |
Previous Message | Tom Lane | 2002-12-09 15:32:59 | Re: Bug #841: SET search_path in createdb -T ... and pgdump |