agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kumar Babu P G <kumar.pulakunta@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Postgres behavior - Conditional statements
Date: Mon, 24 Feb 2014 11:02:30 -0500
Message-ID: <1905.1393257750@sss.pgh.pa.us> (raw)
In-Reply-To: <CAA5_7crQLLN=Wr7gp4ykhmTZxrbtSfXjucQeoi2uyec79N1Z7Q@mail.gmail.com>
References: <CAA5_7crQLLN=Wr7gp4ykhmTZxrbtSfXjucQeoi2uyec79N1Z7Q@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>

Kumar Babu P G <kumar.pulakunta@gmail.com> 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=5ec6b7f1b87f0fa006b8e08a11...

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



view thread (5+ messages)  latest in thread

Message-ID: <1905.1393257750@sss.pgh.pa.us>
Permalink:  ../1905.1393257750@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1905.1393257750@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, kumar.pulakunta@gmail.com
  Subject: Re: Postgres behavior - Conditional statements
  In-Reply-To: <1905.1393257750@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox