Re: Postgres behavior - Conditional statements

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Postgres behavior - Conditional statements
Дата
Msg-id 1905.1393257750@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Postgres behavior - Conditional statements  (Kumar Babu P G <kumar.pulakunta@gmail.com>)
Ответы Re: Postgres behavior - Conditional statements  (David Johnston <polobo@yahoo.com>)
Список pgsql-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=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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Pena Kupen
Дата:
Сообщение: Re: array in function
Следующее
От: David Johnston
Дата:
Сообщение: Re: Postgres behavior - Conditional statements