Thread
-
[PATCH v2] psql: Count all table footer lines in pager setup
Erik Wienhold <ewie@ewie.name> — 2025-05-07T01:43:46Z
Until now every table footer was counted as a single line when determining if the pager is needed. This fails to trigger the pager when describing a view with a long definition using command \d+. Fix that by counting the actual lines of the footer text. --- src/fe_utils/print.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index 4af0f32f2fc..103fef4b46b 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -3416,12 +3416,14 @@ IsPagerNeeded(const printTableContent *cont, int extra_lines, bool expanded, { printTableFooter *f; - /* - * FIXME -- this is slightly bogus: it counts the number of - * footers, not the number of lines in them. - */ for (f = cont->footers; f; f = f->next) - lines++; + { + int f_lines; + + pg_wcssize((const unsigned char *) f->data, strlen(f->data), + cont->opt->encoding, NULL, &f_lines, NULL); + lines += f_lines; + } } *fout = PageOutput(lines + extra_lines, cont->opt); -- 2.50.1 --3at43pmpkp5tdoyi--