From df68e0ca50d982e3dc1dbc39d7868dcbfd011132 Mon Sep 17 00:00:00 2001 From: Erik Wienhold Date: Wed, 7 May 2025 03:43:46 +0200 Subject: [PATCH v1] psql: Count all table footer lines in pager setup 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c index 4af0f32f2fc..accb12145da 100644 --- a/src/fe_utils/print.c +++ b/src/fe_utils/print.c @@ -3416,12 +3416,13 @@ 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++; + for (f = cont->footers; f; f = f->next) { + 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