Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3894e7c

Browse files
committed
When setting default thousands separator when locale has "", use logic
so new thousands separator doesn't match decimal symbol.
1 parent 6f3149e commit 3894e7c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.133 2007/11/21 21:49:22 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.134 2007/11/21 22:28:18 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2007, PostgreSQL Global Development Group
@@ -3915,7 +3915,6 @@ NUM_prepare_locale(NUMProc *Np)
39153915
*/
39163916
if (lconv->decimal_point && *lconv->decimal_point)
39173917
Np->decimal = lconv->decimal_point;
3918-
39193918
else
39203919
Np->decimal = ".";
39213920

@@ -3926,13 +3925,14 @@ NUM_prepare_locale(NUMProc *Np)
39263925
* Number thousands separator
39273926
*
39283927
* Some locales (e.g. broken glibc pt_BR), have a comma for decimal,
3929-
* but "" for thousands_sep, so we make the thousands_sep comma
3930-
* too. 2007-02-12
3928+
* but "" for thousands_sep, so we set the thousands_sep too. 2007-02-12
39313929
*/
39323930
if (lconv->thousands_sep && *lconv->thousands_sep)
39333931
Np->L_thousands_sep = lconv->thousands_sep;
3934-
else
3932+
else if (strcmp(Np->decimal, ",") != 0)
39353933
Np->L_thousands_sep = ",";
3934+
else
3935+
Np->L_thousands_sep = ".";
39363936

39373937
/*
39383938
* Currency symbol

src/bin/psql/print.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.91 2007/01/05 22:19:49 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.92 2007/11/21 22:28:18 momjian Exp $
77
*
88
* Note: we include postgres.h not postgres_fe.h so that we can include
99
* catalog/pg_type.h, and thereby have access to INT4OID and similar macros.
@@ -2039,7 +2039,7 @@ setDecimalLocale(void)
20392039
grouping = "3"; /* most common */
20402040
if (*extlconv->thousands_sep)
20412041
thousands_sep = strdup(extlconv->thousands_sep);
2042-
else if (*decimal_point != ',')
2042+
else if (strcmp(decimal_point, ",") != 0)
20432043
thousands_sep = ",";
20442044
else
20452045
thousands_sep = ".";

0 commit comments

Comments
 (0)