33 *
44 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
55 *
6- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.82 2006/02/10 22:29:06 tgl Exp $
6+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.83 2006/02/12 02:56:21 tgl Exp $
77 */
88#include "postgres_fe.h"
99#include "common.h"
@@ -573,11 +573,15 @@ print_aligned_text(const char *title, const char *const * headers,
573573for (j = 0 ;j < col_count ;j ++ )
574574{
575575struct lineptr * this_line = col_lineptrs [j ]+ line_count ;
576+ bool finalspaces = (opt_border == 2 || j != col_count - 1 );
577+
576578if (complete [j ])/* Just print spaces... */
577- fprintf (fout ,"%*s" ,widths [j ],"" );
579+ {
580+ if (finalspaces )
581+ fprintf (fout ,"%*s" ,widths [j ],"" );
582+ }
578583else
579584{
580-
581585/* content */
582586if (opt_align [j ]== 'r' )
583587{
@@ -602,7 +606,7 @@ print_aligned_text(const char *title, const char *const * headers,
602606}
603607else
604608fprintf (fout ,"%-s%*s" ,this_line -> ptr ,
605- widths [j ]- this_line -> width ,"" );
609+ finalspaces ? ( widths [j ]- this_line -> width ) : 0 ,"" );
606610/* If at the right height, done this col */
607611if (line_count == heights [j ]- 1 || !this_line [1 ].ptr )
608612{