diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-02-12 02:56:21 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-02-12 02:56:21 +0000 |
commit | 3f9d2edddc2b0fec31464fe2dcbd26038f00294e (patch) | |
tree | d3a33998785023dedb943fb03706cfd8dc0debf2 /src | |
parent | 07bae9c099f08e9c8af4212f8c636ab6c96ed2dc (diff) | |
download | postgresql-3f9d2edddc2b0fec31464fe2dcbd26038f00294e.tar.gz postgresql-3f9d2edddc2b0fec31464fe2dcbd26038f00294e.zip |
Restore previous psql behavior of not printing useless trailing spaces
after the data in the last column on a line.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/print.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 64c644784f1..1b1ff260f84 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.82 2006/02/10 22:29:06 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.83 2006/02/12 02:56:21 tgl Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -573,11 +573,15 @@ print_aligned_text(const char *title, const char *const * headers, for (j = 0; j < col_count; j++) { struct lineptr *this_line = col_lineptrs[j] + line_count; + bool finalspaces = (opt_border == 2 || j != col_count-1); + if (complete[j]) /* Just print spaces... */ - fprintf(fout, "%*s", widths[j], ""); + { + if (finalspaces) + fprintf(fout, "%*s", widths[j], ""); + } else { - /* content */ if (opt_align[j] == 'r') { @@ -602,7 +606,7 @@ print_aligned_text(const char *title, const char *const * headers, } else fprintf(fout, "%-s%*s", this_line->ptr, - widths[j] - this_line->width, ""); + finalspaces ? (widths[j] - this_line->width) : 0, ""); /* If at the right height, done this col */ if (line_count == heights[j]-1 || !this_line[1].ptr) { |