]> granicus.if.org Git - postgresql/commitdiff
Further adjustment to psql's print_aligned_vertical() function.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 Dec 2015 16:07:29 +0000 (11:07 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 1 Dec 2015 16:07:51 +0000 (11:07 -0500)
We should ignore output_columns unless it's greater than zero.
A zero means we couldn't get any information from ioctl(TIOCGWINSZ);
in that case the expected behavior is to print the data at native width,
not to wrap it at the smallest possible value.  print_aligned_text()
gets this consideration right, but print_aligned_vertical() lost track
of this detail somewhere along the line.

src/bin/psql/print.c

index b53e81be37924d7e302ab6c815ed7105ec07ed5e..e103d5b084110582aa7ec9a91c7b519941dc7de0 100644 (file)
@@ -1424,7 +1424,8 @@ print_aligned_vertical(const printTableContent *cont, FILE *fout)
                        if (rwidth > min_width)
                                min_width = rwidth;
 
-                       if (width < min_width || output_columns < min_width)
+                       if (width < min_width ||
+                               (output_columns > 0 && output_columns < min_width))
                        {
                                /* Set data width to match min_width */
                                newdwidth = min_width - hwidth - swidth;