| From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> | 
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> | 
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> | 
| Subject: | Re: Add \pset options for boolean value display | 
| Date: | 2025-11-03 16:44:23 | 
| Message-ID: | 202511031535.xh3bgfmqzkqa@alvherre.pgsql | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
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/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2025-11-03 16:53:35 | Re: Make PGOAUTHCAFILE in libpq-oauth work out of debug mode | 
| Previous Message | Robert Haas | 2025-11-03 16:41:35 | Re: pg_plan_advice |