Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJg8e-00086j-Ud for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Nov 2018 14:46:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJg8b-0005nL-QT for pgsql-bugs@arkaria.postgresql.org; Mon, 05 Nov 2018 14:45:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJg8b-0005nE-Gv for pgsql-bugs@lists.postgresql.org; Mon, 05 Nov 2018 14:45:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJg8Z-0003iI-4q for pgsql-bugs@postgresql.org; Mon, 05 Nov 2018 14:45:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wA5Ejrer007648; Mon, 5 Nov 2018 09:45:53 -0500 From: Tom Lane To: Kamenoqd Zelen cc: pgsql-bugs@postgresql.org Subject: Re: postgres - CASE evaluates subexpression that is not needed to determine the result In-reply-to: References: Comments: In-reply-to Kamenoqd Zelen message dated "Mon, 05 Nov 2018 15:07:05 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7646.1541429153.1@sss.pgh.pa.us> Date: Mon, 05 Nov 2018 09:45:53 -0500 Message-ID: <7647.1541429153@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Kamenoqd Zelen writes: > I have the following 3 examples of case expressions in postgres, which I > would expect to evaluate in the same way. However the first and the third > give ERROR: invalid input syntax for integer: "2017.7". The second one > returns true. Why is the difference? Constant subexpressions get folded regardless of location. regards, tom lane