Re: psql: add \pset true/false

From: "Daniel Verite" <daniel(at)manitou-mail(dot)org>
To: "Matthijs van der Vleuten" <matthijs(at)zr40(dot)nl>
Cc: "Brendan Jurd" <direvus(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Marko Tiikkaja" <marko(at)joh(dot)to>, "PostgreSQL hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: add \pset true/false
Date: 2015-11-12 19:38:49
Message-ID: 779ab8a4-2364-4980-bd2f-49e83619d701@mm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Matthijs van der Vleuten wrote:

> -1 for changing boolout(). It will break anything that receives
> boolean values from the server.

Not if the default output is still 't' or 'f' like now.
Nobody seems to suggest a gratuitous compatibility break.

> How a client is going to display values (of any
> type) is logic that should belong in the client, not in the protocol.

Maybe in general, but consider two problems here:

#1: postgres type extensibility implies that clients
display values from types they know nothing about.
It makes sense that they just use the text representation
that comes from the server, unless they have a specific
reason not to.

#2: in the case of built-in types, like boolean, it's not sufficient
to change how the base type gets displayed.
With Marko's patch, array[true,false] is still displayed as {t,f}
when setting aternatives through the proposed \pset
feature. Same problem inside composite types as mentioned
upthread.

The issue with the patch's approach is that it falls short of
identifying bools in all situations, so the results are inconsistent.
Solving that in psql is hard or possibly irrealistic, because
the reliance on the text representation for complex types goes deep.

By contrast, making the server-side representation configurable seems
easier. Plus it might be of interest for other consumers of resultsets,
outside of psql.

Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-11-12 19:41:03 Re: BUG #13741: vacuumdb does not accept valid password
Previous Message Fabien COELHO 2015-11-12 19:25:34 Re: checkpointer continuous flushing