pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Add \pset options for boolean value display
Date: Mon, 3 Nov 2025 17:44:23 +0100
Message-ID: <202511031535.xh3bgfmqzkqa@alvherre.pgsql> (raw)
In-Reply-To: <202510202105.7hm2cy2m6qye@alvherre.pgsql>

On 2025-Oct-21, Álvaro Herrera wrote:
> On 2025-Oct-20, David G. Johnston wrote:
> > Thank you.  Seems good from a quick read.  I’m regretting the choice of the
> > display_ prefix; is there any technical limitation or other opposition to
> > using just true and false?
> > 
> > \pset true ‘true’
> > \pset false ‘false’

> Uhm.  I don't know.  [...]  I'll gladly take a vote.

I got zero votes and lots of digression, so I have pushed with your
original choice of "display_true" and "display_false".  The "true" and
"false" variable names sound too generic and I think they're more likely
to cause confusion.  I think "null" is not a great name either, but it's
been there since forever so I'm not going to propose changing it.

It's always been the case that for machine-readable output, --no-psqlrc
should be used, and a majority of interesting scripts I've seen do that
already, so I don't expect lots of breakage.  (Also, such a script is
easy to fix if anyone runs into trouble.)

I have added this to my stock .psqlrc as dogfooding experiment:

select :VERSION_NUM >= 190000 as bool_display \gset
\if :bool_display
\pset display_true YES
\pset display_false no
\unset bool_display
\endif

This means I get support for it when connecting to older servers with
new psql, and if I use the old psql, things behave normally with no
extra noise.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





view thread (23+ messages)  latest in thread

Message-ID: <202511031535.xh3bgfmqzkqa@alvherre.pgsql>
Permalink:  ../202511031535.xh3bgfmqzkqa@alvherre.pgsql/
Also on:    postgresql.org/message-id/202511031535.xh3bgfmqzkqa@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@kurilemu.de, david.g.johnston@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Add \pset options for boolean value display
  In-Reply-To: <202511031535.xh3bgfmqzkqa@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox