aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-11-21 12:37:09 -0500
committerAndrew Dunstan <andrew@dunslane.net>2014-11-21 12:37:09 -0500
commit4077fb4d1d34ad04dfb95ba676c2b43ea1f1da53 (patch)
tree18638fe90082a784b86023d4c57dc9b9fbbdf0ce
parente4d28175a13d47a747b33e87c0f808b2ef57c0cd (diff)
downloadpostgresql-4077fb4d1d34ad04dfb95ba676c2b43ea1f1da53.tar.gz
postgresql-4077fb4d1d34ad04dfb95ba676c2b43ea1f1da53.zip
Fix an error in psql that overcounted output lines.
This error counted the first line of a cell as "extra". The effect was to cause far too frequent invocation of the pager. In most cases this can be worked around (for example, by using the "less" pager with the -F flag), so don't backpatch.
-rw-r--r--src/bin/psql/print.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 3b3c3b73d95..fd26d6d1afb 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -836,7 +836,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
{
unsigned int extra_lines;
- extra_lines = (width - 1) / width_wrap[i] + nl_lines;
+ /* don't count the first line of nl_lines - it's not "extra" */
+ extra_lines = ((width - 1) / width_wrap[i]) + nl_lines - 1;
if (extra_lines > extra_row_output_lines)
extra_row_output_lines = extra_lines;
}