Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group