aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2008-06-26 16:06:37 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2008-06-26 16:06:37 +0000
commit5ff98999334aa2f9cb3dcf542a54e07e59cf5881 (patch)
tree88d5fbff45f41c66f2bd01ca4ec785665e09eed3 /src
parent13c843d085fa0866eb9b8e7208d012ea7f93563f (diff)
downloadpostgresql-5ff98999334aa2f9cb3dcf542a54e07e59cf5881.tar.gz
postgresql-5ff98999334aa2f9cb3dcf542a54e07e59cf5881.zip
Fix bug "select lower('asd') = 'asd'" returns false with multibyte encoding
and non-C locale. Fix is just to use correct source's length for char2wchar call.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/formatting.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index c435d4ba837..9d3439f1f77 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.143 2008/06/23 19:27:19 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.144 2008/06/26 16:06:37 teodor Exp $
*
*
* Portions Copyright (c) 1999-2008, PostgreSQL Global Development Group
@@ -1454,7 +1454,7 @@ str_tolower(char *buff, size_t nbytes)
/* Output workspace cannot have more codes than input bytes */
workspace = (wchar_t *) palloc((nbytes + 1) * sizeof(wchar_t));
- char2wchar(workspace, nbytes + 1, buff, nbytes + 1);
+ char2wchar(workspace, nbytes + 1, buff, nbytes);
for (curr_char = 0; workspace[curr_char] != 0; curr_char++)
workspace[curr_char] = towlower(workspace[curr_char]);
@@ -1502,7 +1502,7 @@ str_toupper(char *buff, size_t nbytes)
/* Output workspace cannot have more codes than input bytes */
workspace = (wchar_t *) palloc((nbytes + 1) * sizeof(wchar_t));
- char2wchar(workspace, nbytes + 1, buff, nbytes + 1);
+ char2wchar(workspace, nbytes + 1, buff, nbytes);
for (curr_char = 0; workspace[curr_char] != 0; curr_char++)
workspace[curr_char] = towupper(workspace[curr_char]);
@@ -1551,7 +1551,7 @@ str_initcap(char *buff, size_t nbytes)
/* Output workspace cannot have more codes than input bytes */
workspace = (wchar_t *) palloc((nbytes + 1) * sizeof(wchar_t));
- char2wchar(workspace, nbytes + 1, buff, nbytes + 1);
+ char2wchar(workspace, nbytes + 1, buff, nbytes);
for (curr_char = 0; workspace[curr_char] != 0; curr_char++)
{