Re: BUG #8237: CASE Expression - Order of expression processing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: andrea(at)lombardoni(dot)ch, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #8237: CASE Expression - Order of expression processing
Date: 2013-06-19 03:30:44
Message-ID: 10821.1371612644@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Илья Султанов 2013-06-19 03:53:33 unknown mistake
Previous Message niflheim123 2013-06-18 16:05:49 BUG #8239: postgresql cannot run after install with apt-get because of permisions