MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:bar Date:October 3 2006 9:12am
Subject:bk commit into 4.1 tree (bar:1.2554) BUG#22052
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-10-03 14:11:57+05:00, bar@stripped +4 -0
  Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
    Fix: using charset-aware functions cs->cset->lengthsp() and cs->cset->fill()
    instead of single byte code which is not UCS2 compatible.

  myisam/mi_key.c@stripped, 2006-10-03 14:11:54+05:00, bar@stripped +8 -7
    Using character-set aware functions to trim and append spaces.
    

  myisam/mi_open.c@stripped, 2006-10-03 14:11:54+05:00, bar@stripped +2 -0
    Initialize charset for BINARY/VARBINARY to my_charset_bin,
        instead of NULL
    

  mysql-test/r/ctype_ucs.result@stripped, 2006-10-03 14:11:54+05:00, bar@stripped +22 -0
    Adding test case

  mysql-test/t/ctype_ucs.test@stripped, 2006-10-03 14:11:54+05:00, bar@stripped +18 -0
    Adding test case

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-4.1-rpl.b8663

--- 1.38/myisam/mi_key.c	2006-10-03 14:12:04 +05:00
+++ 1.39/myisam/mi_key.c	2006-10-03 14:12:04 +05:00
@@ -42,7 +42,7 @@
 uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
 		  const byte *record, my_off_t filepos)
 {
-  byte *pos,*end;
+  byte *pos;
   uchar *start;
   reg1 HA_KEYSEG *keyseg;
   my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
@@ -84,18 +84,17 @@
     pos= (byte*) record+keyseg->start;
     if (keyseg->flag & HA_SPACE_PACK)
     {
-      end= pos + length;
       if (type != HA_KEYTYPE_NUM)
       {
-	while (end > pos && end[-1] == ' ')
-	  end--;
+        length= cs->cset->lengthsp(cs, pos, length);
       }
       else
       {
+        byte *end= pos + length;
 	while (pos < end && pos[0] == ' ')
 	  pos++;
+	length=(uint) (end-pos);
       }
-      length=(uint) (end-pos);
       FIX_LENGTH(cs, pos, length, char_length);
       store_key_length_inc(key,char_length);
       memcpy((byte*) key,(byte*) pos,(size_t) char_length);
@@ -358,8 +357,10 @@
       pos= record+keyseg->start;
       if (keyseg->type != (int) HA_KEYTYPE_NUM)
       {
-	memcpy(pos,key,(size_t) length);
-	bfill(pos+length,keyseg->length-length,' ');
+        memcpy(pos,key,(size_t) length);
+        keyseg->charset->cset->fill(keyseg->charset,
+                                    pos + length, keyseg->length - length,
+                                    ' ');
       }
       else
       {

--- 1.85/myisam/mi_open.c	2006-10-03 14:12:04 +05:00
+++ 1.86/myisam/mi_open.c	2006-10-03 14:12:04 +05:00
@@ -323,6 +323,8 @@
 	      goto err;
 	    }
 	  }
+	  else if (pos->type == HA_KEYTYPE_BINARY)
+	    pos->charset= &my_charset_bin;
 	}
 	if (share->keyinfo[i].flag & HA_SPATIAL)
 	{

--- 1.34/mysql-test/r/ctype_ucs.result	2006-10-03 14:12:04 +05:00
+++ 1.35/mysql-test/r/ctype_ucs.result	2006-10-03 14:12:04 +05:00
@@ -715,6 +715,28 @@
 river
 drop table t1;
 deallocate prepare stmt;
+create table t1 (
+a char(10) unicode not null, 
+index a (a)
+) engine=myisam;
+insert into t1 values (repeat(0x201f, 10));
+insert into t1 values (repeat(0x2020, 10));
+insert into t1 values (repeat(0x2021, 10));
+explain select hex(a) from t1 order by a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	a	20	NULL	3	Using index
+select hex(a) from t1 order by a;
+hex(a)
+201F201F201F201F201F201F201F201F201F201F
+2020202020202020202020202020202020202020
+2021202120212021202120212021202120212021
+alter table t1 drop index a;
+select hex(a) from t1 order by a;
+hex(a)
+201F201F201F201F201F201F201F201F201F201F
+2020202020202020202020202020202020202020
+2021202120212021202120212021202120212021
+drop table t1;
 CREATE TABLE t1 (id int, s char(5) CHARACTER SET ucs2 COLLATE ucs2_unicode_ci);
 INSERT INTO t1 VALUES (1, 'ZZZZZ'), (1, 'ZZZ'), (2, 'ZZZ'), (2, 'ZZZZZ');
 SELECT id, MIN(s) FROM t1 GROUP BY id;

--- 1.34/mysql-test/t/ctype_ucs.test	2006-10-03 14:12:04 +05:00
+++ 1.35/mysql-test/t/ctype_ucs.test	2006-10-03 14:12:04 +05:00
@@ -453,6 +453,24 @@
 deallocate prepare stmt;
 
 #
+# Bug#22052 Trailing spaces are not removed from UNICODE fields in an index
+#
+create table t1 (
+  a char(10) unicode not null, 
+  index a (a)
+) engine=myisam;
+insert into t1 values (repeat(0x201f, 10));
+insert into t1 values (repeat(0x2020, 10));
+insert into t1 values (repeat(0x2021, 10));
+# make sure "index read" is used
+explain select hex(a) from t1 order by a;
+select hex(a) from t1 order by a;
+alter table t1 drop index a;
+select hex(a) from t1 order by a;
+drop table t1;
+
+
+#
 # Bug #20076: server crashes for a query with GROUP BY if MIN/MAX aggregation
 #             over a 'ucs2' field uses a temporary table 
 #
Thread
bk commit into 4.1 tree (bar:1.2554) BUG#22052bar3 Oct