BUG #1329: Bug in IF-ELSEIF-ELSE construct

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1329: Bug in IF-ELSEIF-ELSE construct
Date: 2004-11-26 11:14:29
Message-ID: 20041126111429.105AA7388F4@www.postgresql.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-patches


The following bug has been logged online:

Bug reference: 1329
Logged by: Rico Wind

Email address: rw(at)rico-wind(dot)dk

PostgreSQL version: 8.0 Beta

Operating system: Windows XP, SP2

Description: Bug in IF-ELSEIF-ELSE construct

Details:

Beta 1.
The following always returns 4:

IF from_date_param=period_begin AND until_date_param=period_end
THEN
return 1;
ELSEIF from_date_param=period_begin
THEN
return 2;
ELSEIF until_date_param=period_end
THEN
return 3;
ELSE
return 4;
END IF;

Whereas the following returns the right answer(not 4 each time). They should
be the same.
IF from_date_param=period_begin AND until_date_param=period_end
THEN
return 1;
ELSE
IF from_date_param = period_begin
THEN
return 2;
END IF;

IF until_date_param=period_end
THEN
return 3;
END IF;
END IF;
RETURN 4;

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Harald Armin Massa 2004-11-26 12:15:35 Re: Beta Testing of postgresql-8.0.0-beta5
Previous Message Ovcharenko 2004-11-26 08:39:38 Build libpq for win32

Browse pgsql-patches by date

  From Date Subject
Next Message Flynn 2004-11-26 14:07:09 compressed bitvectors for postgresql (and perl, php, etc)
Previous Message Christopher Kings-Lynne 2004-11-26 01:34:33 Improvement to pg_trgm readme