1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Add \pset options for boolean value display

New \pset variables display_true and display_false allow the user to
change how true and false values are displayed.

Author: David G. Johnston <David.G.Johnston@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAKFQuwYts3vnfQ5AoKhEaKMTNMfJ443MW2kFswKwzn7fiofkrw@mail.gmail.com
Discussion: https://postgr.es/m/56308F56.8060908@joh.to
This commit is contained in:
Álvaro Herrera
2025-11-03 17:40:39 +01:00
parent cf8be02253
commit 645cb44c54
8 changed files with 123 additions and 5 deletions

View File

@@ -3775,6 +3775,10 @@ printQuery(const PGresult *result, const printQueryOpt *opt,
if (PQgetisnull(result, r, c))
cell = opt->nullPrint ? opt->nullPrint : "";
else if (PQftype(result, c) == BOOLOID)
cell = (PQgetvalue(result, r, c)[0] == 't' ?
(opt->truePrint ? opt->truePrint : "t") :
(opt->falsePrint ? opt->falsePrint : "f"));
else
{
cell = PQgetvalue(result, r, c);