Skip to content

Commit 4077fb4

Browse files
committed
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.
1 parent e4d2817 commit 4077fb4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/bin/psql/print.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,8 @@ print_aligned_text(const printTableContent *cont, FILE *fout)
836836
{
837837
unsigned int extra_lines;
838838

839-
extra_lines = (width - 1) / width_wrap[i] + nl_lines;
839+
/* don't count the first line of nl_lines - it's not "extra" */
840+
extra_lines = ((width - 1) / width_wrap[i]) + nl_lines - 1;
840841
if (extra_lines > extra_row_output_lines)
841842
extra_row_output_lines = extra_lines;
842843
}

0 commit comments

Comments
 (0)