diff options
author | Jeff Davis <jdavis@postgresql.org> | 2024-12-02 21:59:02 -0800 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2024-12-02 21:59:02 -0800 |
commit | e3fa2b037c6f0f435838e99200050dc54c306085 (patch) | |
tree | c1468cf7a07d6b637e778487e7547e09c66ef8a7 /src/backend/utils/adt/formatting.c | |
parent | 4171c44c9b791da3c00386dc6d8e6b1842e3036b (diff) | |
download | postgresql-e3fa2b037c6f0f435838e99200050dc54c306085.tar.gz postgresql-e3fa2b037c6f0f435838e99200050dc54c306085.zip |
Fix unintentional behavior change in commit e9931bfb75.
Prior to that commit, there was special case to use ASCII case mapping
behavior for the libc provider with a single-byte encoding when that's
the default collation. Commit e9931bfb75 mistakenly eliminated that
special case; this commit restores it.
Discussion: https://postgr.es/m/01a104f0d2179d756261e90d96fd65c36ad6fcf0.camel@j-davis.com
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r-- | src/backend/utils/adt/formatting.c | 30 |
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); } } |