postgresql/src/fe_utils
Tom Lane 56e892a494 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
2026-07-05 18:11:40 -04:00
..
.gitignore Move psql's psqlscan.l into src/fe_utils. 2016-03-24 20:28:47 -04:00
archive.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
astreamer_file.c Prevent path traversal in pg_basebackup and pg_rewind 2026-05-11 05:13:47 -07:00
astreamer_gzip.c Fix multiple bugs in astreamer pipeline code. 2026-03-29 09:01:47 -04:00
astreamer_lz4.c Fix poorly-sized buffers in astreamer compression modules. 2026-03-24 12:17:12 -04:00
astreamer_tar.c Prevent path traversal in pg_basebackup and pg_rewind 2026-05-11 05:13:47 -07:00
astreamer_zstd.c Fix poorly-sized buffers in astreamer compression modules. 2026-03-24 12:17:12 -04:00
cancel.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
conditional.c fe_utils: Sprinkle some pg_malloc_object() and pg_malloc_array() 2026-02-24 12:34:42 +09:00
connect_utils.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Update copyright for 2026 2026-01-01 13:24:10 -05:00
mbprint.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
meson.build meson: allow disabling building/installation of static libraries. 2026-02-23 16:45:40 +01:00
option_utils.c Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
parallel_slot.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
print.c Fix psql's pager selection for wrapped expanded output. 2026-07-05 18:11:40 -04:00
psqlscan.l psql: Tighten heuristics for BEGIN/END within CREATE SCHEMA. 2026-06-23 14:12:03 -04:00
query_utils.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
recovery_gen.c Update copyright for 2026 2026-01-01 13:24:10 -05:00
simple_list.c fe_utils: Sprinkle some pg_malloc_object() and pg_malloc_array() 2026-02-24 12:34:42 +09:00
string_utils.c Restore comment at appendShellString(). 2026-06-29 19:41:15 -07:00
version.c Update copyright for 2026 2026-01-01 13:24:10 -05:00