Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WHxzI-00005D-UD for pgsql-sql@arkaria.postgresql.org; Mon, 24 Feb 2014 16:02:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WHxzI-0007Jn-Bz for pgsql-sql@arkaria.postgresql.org; Mon, 24 Feb 2014 16:02:36 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WHxzG-0007I0-MW for pgsql-sql@postgresql.org; Mon, 24 Feb 2014 16:02:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WHxzE-0006Fe-5E for pgsql-sql@postgresql.org; Mon, 24 Feb 2014 16:02:34 +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 s1OG2UiW001906; Mon, 24 Feb 2014 11:02:31 -0500 From: Tom Lane To: Kumar Babu P G cc: pgsql-sql@postgresql.org Subject: Re: Postgres behavior - Conditional statements In-reply-to: References: Comments: In-reply-to Kumar Babu P G message dated "Mon, 24 Feb 2014 12:07:24 +0530" Date: Mon, 24 Feb 2014 11:02:30 -0500 Message-ID: <1905.1393257750@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org Kumar Babu P G writes: > Found strange behavior of postgres between 9.1 and 9.2. Can some one > pointout the reason for the difference in column name of the output between > the versions? > postgres=> select case when exists (select 1 from test where a=1) then 0 > else (select b from test where a=2) end; http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=5ec6b7f1b87f0fa006b8e08a11cd4e99bcb67358 The behavior of CASE didn't change, but the behavior of the sub-select did. More simply, 9.1 gives this regression=# select (select b from test where a=2); ?column? ---------- (1 row) while 9.2 and up give regression=# select (select b from test where a=2); b --- (1 row) regards, tom lane -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql