Skip to content

Commit 3adba41

Browse files
committed
Add comment on C locale test for upper/lower/initcap().
1 parent d733f11 commit 3adba41

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/backend/utils/adt/oracle_compat.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.59 2005/03/16 01:49:10 momjian Exp $
12+
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.60 2005/05/07 15:18:17 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -167,7 +167,11 @@ Datum
167167
lower(PG_FUNCTION_ARGS)
168168
{
169169
#ifdef USE_WIDE_UPPER_LOWER
170-
/* use wide char code only when max encoding length > 1 and ctype != C */
170+
/*
171+
* Use wide char code only when max encoding length > 1 and ctype != C.
172+
* Some operating systems fail with multi-byte encodings and a C locale.
173+
* Also, for a C locale there is no need to process as multibyte.
174+
*/
171175
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
172176
{
173177
text *string = PG_GETARG_TEXT_P(0);
@@ -229,7 +233,11 @@ Datum
229233
upper(PG_FUNCTION_ARGS)
230234
{
231235
#ifdef USE_WIDE_UPPER_LOWER
232-
/* use wide char code only when max encoding length > 1 and ctype != C */
236+
/*
237+
* Use wide char code only when max encoding length > 1 and ctype != C.
238+
* Some operating systems fail with multi-byte encodings and a C locale.
239+
* Also, for a C locale there is no need to process as multibyte.
240+
*/
233241
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
234242
{
235243
text *string = PG_GETARG_TEXT_P(0);
@@ -294,7 +302,11 @@ Datum
294302
initcap(PG_FUNCTION_ARGS)
295303
{
296304
#ifdef USE_WIDE_UPPER_LOWER
297-
/* use wide char code only when max encoding length > 1 and ctype != C */
305+
/*
306+
* Use wide char code only when max encoding length > 1 and ctype != C.
307+
* Some operating systems fail with multi-byte encodings and a C locale.
308+
* Also, for a C locale there is no need to process as multibyte.
309+
*/
298310
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
299311
{
300312
text *string = PG_GETARG_TEXT_P(0);

0 commit comments

Comments
 (0)