Re: PATCH: psql boolean display

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: PATCH: psql boolean display
Дата
Msg-id CA+Tgmoa5+sA9Q+=HXoHrUsYe6Ek=R5x_nQ3_mF8yx6q+583y_Q@mail.gmail.com
обсуждение исходный текст
Ответ на PATCH: psql boolean display  (Phil Sorber <phil@omniti.com>)
Ответы Re: PATCH: psql boolean display
Список pgsql-hackers
On Sun, Aug 19, 2012 at 12:02 PM, Phil Sorber <phil@omniti.com> wrote:
> I am providing a patch to allow you to change the output of a boolean
> value in psql much like you can do with NULL. A client requested this
> feature and we thought it may appeal to someone else in the community.
>
> The patch includes updated docs and a regression test. The code
> changes themselves are pretty simple and straightforward.
>
> Example from the regression test:
>
> SELECT true, false;
>  bool | bool
> ------+------
>  t    | f
> (1 row)
>
> \pset booltrue 'foo'
> \pset boolfalse 'bar'
> SELECT true, false;
>  bool | bool
> ------+------
>  foo  | bar
> (1 row)
>
> \pset booltrue 't'
> \pset boolfalse 'f'
> SELECT true, false;
>  bool | bool
> ------+------
>  t    | f
> (1 row)
>
> As always, comments welcome.

Why not just do it in the SQL?

SELECT CASE WHEN whatever THEN 'foo' ELSE 'bar' END AS whatever;

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: NOT NULL constraints in foreign tables
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: NOT NULL constraints in foreign tables