Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Up96k-0002h8-JR for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Jun 2013 03:30:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Up96j-0004fL-M1 for pgsql-bugs@arkaria.postgresql.org; Wed, 19 Jun 2013 03:30:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Up96i-0004fE-Nx for pgsql-bugs@postgresql.org; Wed, 19 Jun 2013 03:30:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Up96f-0001co-Ra for pgsql-bugs@postgresql.org; Wed, 19 Jun 2013 03:30:52 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r5J3Uik4010822; Tue, 18 Jun 2013 23:30:44 -0400 (EDT) From: Tom Lane To: Andres Freund cc: andrea@lombardoni.ch, pgsql-bugs@postgresql.org Subject: Re: BUG #8237: CASE Expression - Order of expression processing In-reply-to: <20130618133132.GG5646@awork2.anarazel.de> References: <20130618133132.GG5646@awork2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 18 Jun 2013 15:31:32 +0200" Date: Tue, 18 Jun 2013 23:30:44 -0400 Message-ID: <10821.1371612644@sss.pgh.pa.us> X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund 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 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs