aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r--src/backend/utils/adt/formatting.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 85a7dd45619..2bcc185708c 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1755,7 +1755,12 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
* collations you get exactly what the collation says.
*/
for (p = result; *p; p++)
- *p = tolower_l((unsigned char) *p, mylocale->info.lt);
+ {
+ if (mylocale->is_default)
+ *p = pg_tolower((unsigned char) *p);
+ else
+ *p = tolower_l((unsigned char) *p, mylocale->info.lt);
+ }
}
}
}
@@ -1892,7 +1897,12 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
* collations you get exactly what the collation says.
*/
for (p = result; *p; p++)
- *p = toupper_l((unsigned char) *p, mylocale->info.lt);
+ {
+ if (mylocale->is_default)
+ *p = pg_toupper((unsigned char) *p);
+ else
+ *p = toupper_l((unsigned char) *p, mylocale->info.lt);
+ }
}
}
}
@@ -2090,10 +2100,20 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
*/
for (p = result; *p; p++)
{
- if (wasalnum)
- *p = tolower_l((unsigned char) *p, mylocale->info.lt);
+ if (mylocale->is_default)
+ {
+ if (wasalnum)
+ *p = pg_tolower((unsigned char) *p);
+ else
+ *p = pg_toupper((unsigned char) *p);
+ }
else
- *p = toupper_l((unsigned char) *p, mylocale->info.lt);
+ {
+ if (wasalnum)
+ *p = tolower_l((unsigned char) *p, mylocale->info.lt);
+ else
+ *p = toupper_l((unsigned char) *p, mylocale->info.lt);
+ }
wasalnum = isalnum_l((unsigned char) *p, mylocale->info.lt);
}
}