]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix psql's pager selection for wrapped expanded output.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 5 Jul 2026 22:11:40 +0000 (18:11 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 5 Jul 2026 22:11:40 +0000 (18:11 -0400)
commit07abbc93ba5ba41b60927221db92bc73f75fd1ba
tree494baf7a624e3911c9899fb1c1261b125d583038
parent9f03dab4574bd2820eec6902c2ef12b28c706733
Fix psql's pager selection for wrapped expanded output.

psql decided whether to use the pager in expanded output without
accounting for possible wrapping of column values.  This could
allow it to not use the pager in cases where it should do so.

To fix, move the IsPagerNeeded decision in print_aligned_vertical()
down until after the wrapped data width is known.  Then, if we're in
wrapped mode, prepare a width_wrap array specifying that width (which,
in vertical mode, is the same for all columns).

This is fixing an omission in 27da1a796, so back-patch to v19
where that came in.

Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Erik Wienhold <ewie@ewie.name>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/A44110E7-6A03-4C67-95AD-527192A6C768@gmail.com
Backpatch-through: 19
src/bin/psql/t/030_pager.pl
src/fe_utils/print.c