Skip to content

Commit d1d3f4d

Browse files
committed
Add comment that to_char() for broken glibc pt_BR might cause a problem.
1 parent 33c4a77 commit d1d3f4d

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/backend/utils/adt/formatting.c

+16-12
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.122 2007/02/09 04:17:58 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.123 2007/02/13 02:00:55 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2007, PostgreSQL Global Development Group
@@ -3834,14 +3834,6 @@ NUM_prepare_locale(NUMProc *Np)
38343834
else
38353835
Np->L_positive_sign = "+";
38363836

3837-
/*
3838-
* Number thousands separator
3839-
*/
3840-
if (lconv->thousands_sep && *lconv->thousands_sep)
3841-
Np->L_thousands_sep = lconv->thousands_sep;
3842-
else
3843-
Np->L_thousands_sep = ",";
3844-
38453837
/*
38463838
* Number decimal point
38473839
*/
@@ -3850,16 +3842,28 @@ NUM_prepare_locale(NUMProc *Np)
38503842
else
38513843
Np->decimal = ".";
38523844

3845+
if (!IS_LDECIMAL(Np->Num))
3846+
Np->decimal = ".";
3847+
3848+
/*
3849+
* Number thousands separator
3850+
*
3851+
* Some locales (e.g. broken glibc pt_BR), have a comma for
3852+
* decimal, but "" for thousands_sep, so we might make the
3853+
* thousands_sep comma too. 2007-02-12
3854+
*/
3855+
if (lconv->thousands_sep && *lconv->thousands_sep)
3856+
Np->L_thousands_sep = lconv->thousands_sep;
3857+
else
3858+
Np->L_thousands_sep = ",";
3859+
38533860
/*
38543861
* Currency symbol
38553862
*/
38563863
if (lconv->currency_symbol && *lconv->currency_symbol)
38573864
Np->L_currency_symbol = lconv->currency_symbol;
38583865
else
38593866
Np->L_currency_symbol = " ";
3860-
3861-
if (!IS_LDECIMAL(Np->Num))
3862-
Np->decimal = ".";
38633867
}
38643868
else
38653869
{

0 commit comments

Comments
 (0)