Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2013-06-18 13:17:14 +0000, andrea(at)lombardoni(dot)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