agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make crosstabview honor boolean/null display settings
Date: Fri, 26 Jun 2026 18:05:50 +0000
Message-ID: <E1wdAw3-000J8a-07@gemulon.postgresql.org> (raw)

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@highgo.com>
Reported-by: Chao Li <lic@highgo.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.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(-)



Message-ID: <E1wdAw3-000J8a-07@gemulon.postgresql.org>
Permalink:  ../E1wdAw3-000J8a-07@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wdAw3-000J8a-07@gemulon.postgresql.org

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-committers@postgresql.org
  Cc: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make crosstabview honor boolean/null display settings
  In-Reply-To: <E1wdAw3-000J8a-07@gemulon.postgresql.org>

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

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