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