Skip to content

Commit 177522a

Browse files
author
Alexander Barkov
committed
Bug #51976 LDML collations issue
Problem: caseup_multiply and casedn_multiply members were not initialized for a dynamic collation, so UPPER() and LOWER() functions returned empty strings. Fix: initializing the members properly. Adding tests: mysql-test/r/ctype_ldml.result mysql-test/t/ctype_ldml.test Applying the fix: mysys/charset.c
1 parent 92c7521 commit 177522a

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

mysql-test/r/ctype_ldml.result

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
4949
a
5050
DROP TABLE t1;
5151
#
52+
# Bug#51976 LDML collations issue (cyrillic example)
53+
#
54+
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
55+
INSERT INTO t1 (a) VALUES ('Hello');
56+
SELECT a, UPPER(a), LOWER(a) FROM t1;
57+
a UPPER(a) LOWER(a)
58+
Hello HELLO hello
59+
DROP TABLE t1;
60+
#
5261
# Bug#43827 Server closes connections and restarts
5362
#
5463
CREATE TABLE t1 (c1 VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);

mysql-test/t/ctype_ldml.test

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ INSERT INTO t1 (a) VALUES ('hello!');
4545
SELECT * FROM t1 WHERE LOWER(a)=LOWER('N');
4646
DROP TABLE t1;
4747

48+
--echo #
49+
--echo # Bug#51976 LDML collations issue (cyrillic example)
50+
--echo #
51+
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_test_ci);
52+
INSERT INTO t1 (a) VALUES ('Hello');
53+
SELECT a, UPPER(a), LOWER(a) FROM t1;
54+
DROP TABLE t1;
55+
4856
--echo #
4957
--echo # Bug#43827 Server closes connections and restarts
5058
--echo #

mysys/charset.c

+2
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ static int add_collation(CHARSET_INFO *cs)
245245
if (cs_copy_data(all_charsets[cs->number],cs))
246246
return MY_XML_ERROR;
247247

248+
newcs->caseup_multiply= newcs->casedn_multiply= 1;
249+
248250
if (!strcmp(cs->csname,"ucs2") )
249251
{
250252
#if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS)

0 commit comments

Comments
 (0)