BUG #1406: subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition is true

From: "manikanti sreedhar reddy" <manikant(at)intoto(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1406: subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition is true
Date: 2005-01-17 09:27:27
Message-ID: 200501170927.j0H9RRFT032239@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 1406
Logged by: manikanti sreedhar reddy
Email address: manikant(at)intoto(dot)com
PostgreSQL version: 7.4.2
Operating system: Windows
Description: subsequent WHEN/ELSE is getting validated, eventhough
prior WHEN condition is true
Details:

Subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition
is true.

Let us take an example:

select (CASE WHEN POSITION('/' IN '172.16.1.1-172.16.1.25')=0 THEN FALSE
ELSE (INET('172.16.1.1-172.16.1.25'::INET) >> INET('internalnetwork'::INET)
) END);

In this, example since the first when condition is always true (since / is
not present in '172.16.1.1-172.16.1.25' and POSITION('/' IN
'172.16.1.1-172.16.1.25')=0 always evaluated to true) the expected output is
false. Whereas postgresql is evaluating the INET('intervalnetwork'::INET)
expression which is in ELSE case, which is not supposed to happen!

Thanks,

-Sreedhar Reddy

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manikanti Sreedhar Reddy 2005-01-17 12:59:49 Re: BUG #1406: subsequent WHEN/ELSE is getting
Previous Message Daniel Ceregatti 2005-01-17 03:08:22 Re: Error in 8.0 rc5 with repeat calls to array operator