Possible bug in CASE evaluation - Mailing list pgsql-hackers

From Albe Laurenz
Subject Possible bug in CASE evaluation
Date
Msg-id A737B7A37273E048B164557ADEF4A58B17BB4EF8@ntex2010a.host.magwien.gv.at
Whole thread Raw
Responses Re: Possible bug in CASE evaluation
List pgsql-hackers
I want to draw attention to this thread on -general:
CAMQ5dGq4SuJPbhT2-9XLAPAsvKNUL2-bb0cPyci2Fp+pfSfc3g@mail.gmail.com

Would you concur that this is a bug?

The fine manual says about CASE:
 If the condition's result is true, the value of the CASE expression is the result that follows the condition, and the
remainderof the CASE expression is not processed.
 

But:

test=> CREATE FUNCTION zero() RETURNS integer IMMUTABLE LANGUAGE SQL AS 'SELECT 0';
CREATE FUNCTION
test=> SELECT CASE WHEN (SELECT zero()) = 0 THEN -1 ELSE 1/zero() END;
ERROR:  division by zero

Yours,
Laurenz Albe

pgsql-hackers by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Frontend/backend protocol improvements proposal (request).
Next
From: KONDO Mitsumasa
Date:
Subject: Re: Improvement of checkpoint IO scheduler for stable transaction responses