Index: src/backend/utils/adt/formatting.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v
retrieving revision 1.133
diff -c -c -r1.133 formatting.c
*** src/backend/utils/adt/formatting.c	21 Nov 2007 21:49:22 -0000	1.133
--- src/backend/utils/adt/formatting.c	21 Nov 2007 22:24:52 -0000
***************
*** 3915,3921 ****
  		 */
  		if (lconv->decimal_point && *lconv->decimal_point)
  			Np->decimal = lconv->decimal_point;
- 
  		else
  			Np->decimal = ".";
  
--- 3915,3920 ----
***************
*** 3926,3938 ****
  		 * Number thousands separator
  		 *
  		 * Some locales (e.g. broken glibc pt_BR), have a comma for decimal,
! 		 * but "" for thousands_sep, so we make the thousands_sep comma
! 		 * too.  2007-02-12
  		 */
  		if (lconv->thousands_sep && *lconv->thousands_sep)
  			Np->L_thousands_sep = lconv->thousands_sep;
! 		else
  			Np->L_thousands_sep = ",";
  
  		/*
  		 * Currency symbol
--- 3925,3938 ----
  		 * Number thousands separator
  		 *
  		 * Some locales (e.g. broken glibc pt_BR), have a comma for decimal,
! 		 * but "" for thousands_sep, so we set the thousands_sep too. 2007-02-12
  		 */
  		if (lconv->thousands_sep && *lconv->thousands_sep)
  			Np->L_thousands_sep = lconv->thousands_sep;
! 		else if (strcmp(Np->decimal, ",") != 0)
  			Np->L_thousands_sep = ",";
+ 		else
+ 			Np->L_thousands_sep = ".";
  
  		/*
  		 * Currency symbol
Index: src/bin/psql/print.c
===================================================================
RCS file: /cvsroot/pgsql/src/bin/psql/print.c,v
retrieving revision 1.91
diff -c -c -r1.91 print.c
*** src/bin/psql/print.c	5 Jan 2007 22:19:49 -0000	1.91
--- src/bin/psql/print.c	21 Nov 2007 22:24:53 -0000
***************
*** 2039,2045 ****
  		grouping = "3";			/* most common */
  	if (*extlconv->thousands_sep)
  		thousands_sep = strdup(extlconv->thousands_sep);
! 	else if (*decimal_point != ',')
  		thousands_sep = ",";
  	else
  		thousands_sep = ".";
--- 2039,2045 ----
  		grouping = "3";			/* most common */
  	if (*extlconv->thousands_sep)
  		thousands_sep = strdup(extlconv->thousands_sep);
! 	else if (strcmp(decimal_point, ",") != 0)
  		thousands_sep = ",";
  	else
  		thousands_sep = ".";
