List:Commits« Previous MessageNext Message »
From:Alexander Barkov Date:July 23 2008 5:33am
Subject:commit into mysql-6.0-backup branch (bar:2737) Bug#33073
View as plain text  
#At file:///home/bar/mysql-bzr/mysql-6.0.b33073/

 2737 Alexander Barkov	2008-07-23
      Bug#33073 Character sets: ordering fails with utf32
      Problem: un-indexed ORDER BY didn't work on short UTF32 columns,
      and didn't work with UTF16 columns with short max_sort_length value.
      Fix: condition to break the loop in my_strnxfrm_utf16/_utf32 was
      incorrect - the very last character didn't get into the output sort string.
      
      Adding tests:
        mysql-test/r/ctype_utf16.result
        mysql-test/r/ctype_utf32.result
        mysql-test/t/ctype_utf16.test
        mysql-test/t/ctype_utf32.test
      
      Fixing loop break condition:
        strings/ctype-ucs2.c
modified:
  mysql-test/r/ctype_utf16.result
  mysql-test/r/ctype_utf32.result
  mysql-test/t/ctype_utf16.test
  mysql-test/t/ctype_utf32.test
  strings/ctype-ucs2.c

=== modified file 'mysql-test/r/ctype_utf16.result'
--- a/mysql-test/r/ctype_utf16.result	2008-07-22 09:25:46 +0000
+++ b/mysql-test/r/ctype_utf16.result	2008-07-23 05:32:40 +0000
@@ -1117,3 +1117,27 @@
 DROP TABLE t1;
 SET timestamp=0;
 SET NAMES latin1;
+SET collation_connection=utf16_general_ci;
+CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `s1` varchar(2) CHARACTER SET utf16 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
+SELECT * FROM t1 ORDER BY s1;
+s1
+ab
+ab
+AE
+AE
+SET max_sort_length=4;
+SELECT * FROM t1 ORDER BY s1;
+s1
+ab
+ab
+AE
+AE
+DROP TABLE t1;
+SET max_sort_length=DEFAULT;
+SET NAMES latin1;

=== modified file 'mysql-test/r/ctype_utf32.result'
--- a/mysql-test/r/ctype_utf32.result	2008-07-22 09:25:46 +0000
+++ b/mysql-test/r/ctype_utf32.result	2008-07-23 05:32:40 +0000
@@ -1129,3 +1129,27 @@
 hex(s1)	hex(s2)
 00000100	00000100
 drop table t1;
+SET collation_connection=utf16_general_ci;
+CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `s1` varchar(2) CHARACTER SET utf16 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
+SELECT * FROM t1 ORDER BY s1;
+s1
+ab
+ab
+AE
+AE
+SET max_sort_length=4;
+SELECT * FROM t1 ORDER BY s1;
+s1
+ab
+ab
+AE
+AE
+DROP TABLE t1;
+SET max_sort_length=DEFAULT;
+SET NAMES latin1;

=== modified file 'mysql-test/t/ctype_utf16.test'
--- a/mysql-test/t/ctype_utf16.test	2008-07-22 09:25:46 +0000
+++ b/mysql-test/t/ctype_utf16.test	2008-07-23 05:32:40 +0000
@@ -714,6 +714,19 @@
 --source include/ctype_datetime.inc
 SET NAMES latin1;
 
+#
+# Bug#33073 Character sets: ordering fails with utf32
+#
+SET collation_connection=utf16_general_ci;
+CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
+SELECT * FROM t1 ORDER BY s1;
+SET max_sort_length=4;
+SELECT * FROM t1 ORDER BY s1;
+DROP TABLE t1;
+SET max_sort_length=DEFAULT;
+SET NAMES latin1;
 
 #
 ## TODO: add tests for all engines

=== modified file 'mysql-test/t/ctype_utf32.test'
--- a/mysql-test/t/ctype_utf32.test	2008-07-22 09:25:46 +0000
+++ b/mysql-test/t/ctype_utf32.test	2008-07-23 05:32:40 +0000
@@ -770,3 +770,18 @@
 insert into t1 values (char(256 using utf32), char(256 using utf32));
 select hex(s1), hex(s2) from t1;
 drop table t1;
+
+#
+# Bug#33073 Character sets: ordering fails with utf32
+#
+SET collation_connection=utf16_general_ci;
+CREATE TABLE t1 AS SELECT repeat('a',2) as s1 LIMIT 0;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES ('ab'),('AE'),('ab'),('AE');
+SELECT * FROM t1 ORDER BY s1;
+SET max_sort_length=4;
+SELECT * FROM t1 ORDER BY s1;
+DROP TABLE t1;
+SET max_sort_length=DEFAULT;
+SET NAMES latin1;
+

=== modified file 'strings/ctype-ucs2.c'
--- a/strings/ctype-ucs2.c	2008-07-15 10:59:07 +0000
+++ b/strings/ctype-ucs2.c	2008-07-23 05:32:40 +0000
@@ -1385,7 +1385,7 @@
     if (uni_plane)
       my_tosort_utf16(uni_plane, &wc);
     
-    if (dst + 2 >= de)
+    if (dst + 2 > de)
       break;
     
     *dst++= (uchar) (wc >> 8);
@@ -2214,7 +2214,7 @@
     if (uni_plane)
       my_tosort_utf32(uni_plane, &wc);
     
-    if (dst + 2 >= de)
+    if (dst + 2 > de)
       break;
     
     *dst++= (uchar) (wc >> 8);

Thread
commit into mysql-6.0-backup branch (bar:2737) Bug#33073Alexander Barkov23 Jul