Re: PATCH: psql boolean display

From: Thom Brown <thom(at)linux(dot)com>
To: Phil Sorber <phil(at)omniti(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: PATCH: psql boolean display
Date: 2012-08-20 22:30:35
Message-ID: CAA-aLv5SOqKaUmH3z1b0U54EQ-WffF5jaursBTwOJ48fHhE8zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20 August 2012 23:16, Phil Sorber <phil(at)omniti(dot)com> wrote:
>
> On Aug 20, 2012 6:08 PM, "Thom Brown" <thom(at)linux(dot)com> wrote:
>>
>> On 20 August 2012 23:06, Phil Sorber <phil(at)omniti(dot)com> wrote:
>> >
>> > On Aug 20, 2012 5:56 PM, "Thom Brown" <thom(at)linux(dot)com> wrote:
>> >>
>> >> On 20 August 2012 22:31, Phil Sorber <phil(at)omniti(dot)com> wrote:
>> >> > On Aug 20, 2012 5:19 PM, "Phil Sorber" <phil(at)omniti(dot)com> wrote:
>> >> >>
>> >> >> On Aug 20, 2012 5:11 PM, "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
>> >> >> wrote:
>> >> >> >
>> >> >> > 2012/8/20 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> >> >> > > On Sun, Aug 19, 2012 at 12:02 PM, Phil Sorber <phil(at)omniti(dot)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;
>> >> >> >
>> >> >> > I understand this motivation - although I was more happy with
>> >> >> > server
>> >> >> > side solution.
>> >> >> >
>> >> >>
>> >> >> Was a server side implementation submitted before? I can change it,
>> >> >> but
>> >> >> I
>> >> >> did it on the client side like the null display was done.
>> >> >
>> >> > Or how about both?
>> >>
>> >> Surely one would break the other?
>> >>
>> >
>> > If using both.
>>
>> Yes. :)
>
> Really server would override client.

Come to think of it, if the client could detect the server's bool out
config, it could override the server in that instance since it would
know what it was looking for, so perhaps they could coexist.

--
Thom

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Phil Sorber 2012-08-20 22:31:57 Re: PATCH: psql boolean display
Previous Message Kevin Grittner 2012-08-20 22:28:04 Re: PATCH: psql boolean display