pgsql: Make crosstabview honor boolean/null display settings

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make crosstabview honor boolean/null display settings
Date: 2026-06-26 18:05:50
Message-ID: E1wdAw3-000J8a-07@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make crosstabview honor boolean/null display settings

psql's \pset display_true/false settings, added by commit 645cb44c5490,
affect normal query output, but not \crosstabview. As a result, boolean
values used anywhere in crosstab output were always shown as "t" or "f",
which is inconsistent. Change \crosstabview so that the configured
values are displayed instead.

While at it, make \crosstabview print the \pset null string, if any, in
cells for which the query produces a NULL value. Cells for which the
query produces no value continue to have the empty string. This is an
oversight in the aboriginal \crosstabview commit, c09b18f21c52.

Add a regression test covering all of this.

Author: Chao Li <lic(at)highgo(dot)com>
Reported-by: Chao Li <lic(at)highgo(dot)com>
Reviewed-by: David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
Reviewed-by: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Backpatch: none needed
Discussion: https://postgr.es/m/B5E6F0A5-4B48-46D0-B5EB-CF8F8CC7D07D@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4df5fe3833a87f6629eb888ca5a385bcb0b179d9

Modified Files
--------------
src/bin/psql/crosstabview.c | 59 +++++++++++++++++++++--------
src/test/regress/expected/psql_crosstab.out | 29 ++++++++++++++
src/test/regress/sql/psql_crosstab.sql | 24 ++++++++++++
3 files changed, 96 insertions(+), 16 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Tomas Vondra 2026-06-26 17:54:49 pgsql: Fix out-of-bounds access in autoprewarm worker