Re: BUG #8237: CASE Expression - Order of expression processing - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #8237: CASE Expression - Order of expression processing
Date
Msg-id 10821.1371612644@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #8237: CASE Expression - Order of expression processing  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: BUG #8237: CASE Expression - Order of expression processing
List pgsql-bugs
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-06-18 13:17:14 +0000, andrea@lombardoni.ch wrote:
>> template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/0 END;
>> ERROR:  division by zero

> Hrmpf. This is rather annoying.

Annoying, maybe.  Bug, no.  The manual is pretty clear that you don't
have a lot of control over order of evaluation of subexpressions.

> So it seems we need to stop processing after finding a single WHEN
> that's not const?

That's not an acceptable "fix".

            regards, tom lane

pgsql-bugs by date:

Previous
From: niflheim123@gmail.com
Date:
Subject: BUG #8239: postgresql cannot run after install with apt-get because of permisions
Next
From: Andres Freund
Date:
Subject: Re: BUG #8237: CASE Expression - Order of expression processing