BUG #1406: subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition is true - Mailing list pgsql-bugs

From manikanti sreedhar reddy
Subject BUG #1406: subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition is true
Date
Msg-id 200501170927.j0H9RRFT032239@developer.pgadmin.org
Whole thread Raw
Responses Re: BUG #1406: subsequent WHEN/ELSE is getting  (Manikanti Sreedhar Reddy <manikant@intoto.com>)
Re: BUG #1406: subsequent WHEN/ELSE is getting validated, eventhough prior WHEN condition is true  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1406
Logged by:          manikanti sreedhar reddy
Email address:      manikant@intoto.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

pgsql-bugs by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: BUG #1393: Adding 'LIMIT 1' to the query halts forever
Next
From: Manikanti Sreedhar Reddy
Date:
Subject: Re: BUG #1406: subsequent WHEN/ELSE is getting