Re: psql: add \pset true/false

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Daniel Verite <daniel(at)manitou-mail(dot)org>, PostgreSQL hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: add \pset true/false
Date: 2015-10-29 13:50:27
Message-ID: 27336.1446126627@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marko Tiikkaja <marko(at)joh(dot)to> writes:
> On 10/29/15 11:51 AM, Daniel Verite wrote:
>> Personally I think it would be worth having, but how about
>> booleans inside ROW() or composite types ?

> There's not enough information sent over to do that in the client.
> Note that this works the same way as \pset null with SELECT
> ROW(NULL), so I don't consider it a show stopper for the patch.

The problem with that argument is that \pset null is already a kluge
(but at least a datatype-independent one). Now you've added a datatype
specific kluge of the same ilk. It might be useful, it might be short,
but that doesn't make it not a kluge.

The really key argument that hasn't been addressed here is why does such
a behavior belong in psql, rather than elsewhere? Surely legibility
problems aren't unique to psql users. Moreover, there are exactly
parallel facilities for other datatypes on the server side: think
DateStyle or bytea_output. So if you were trying to follow precedent
rather than invent a kluge, you'd have submitted a patch to create a GUC
that changes the output of boolout().

Now, that would create a debate about backwards compatibility and whether
making bool output more readable was worth possibly breaking some
applications, but I do not think this patch should escape scrutiny for the
same issue. There are plenty of people with shell scripts that look at
psql output, which might get broken by careless use of this \pset.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Дмитрий Воронин 2015-10-29 14:05:02 Re: pg_dump
Previous Message Vladimir Borodin 2015-10-29 13:39:22 Re: [ADMIN] Replication slots and isolation levels