List:Commits« Previous MessageNext Message »
From:kgeorge Date:April 26 2006 1:33pm
Subject:bk commit into 4.1 tree (gkodinov:1.2459) BUG#19080
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of kgeorge. When kgeorge 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
  1.2459 06/04/26 14:33:53 gkodinov@stripped +3 -0
  Bug#19080: Sub_part indexes on utf8 varchar fields are broken for UPDATE
  
  When comparing partially indexed fields in UPDATE the Field_string::cmp()
  function calls strnncollsp() passing it the full length of the field,
  not trimmed to the length of the actual character length that is available.
  
  So the calculation of the truncated byte length is moved from the other
  branch of the if statement so it's valid for both branches of that if.

  sql/field.cc
    1.230 06/04/26 14:33:50 gkodinov@stripped +11 -11
    Moved the calculation so it takes the character 
    length into account.

  mysql-test/t/ctype_utf8.test
    1.72 06/04/26 14:33:50 gkodinov@stripped +20 -0
    Testsuite for the bug

  mysql-test/r/ctype_utf8.result
    1.70 06/04/26 14:33:50 gkodinov@stripped +13 -0
    Testsuite for the bug

# 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:	gkodinov
# Host:	rakia.progem.bg
# Root:	/home/kgeorge/mysql/4.1/B16699

--- 1.229/sql/field.cc	2006-03-28 16:32:37 +03:00
+++ 1.230/sql/field.cc	2006-04-26 14:33:50 +03:00
@@ -5072,17 +5072,6 @@
 {
   uint a_len, b_len;
 
-  if (field_charset->strxfrm_multiply > 1)
-  {
-    /*
-      We have to remove end space to be able to compare multi-byte-characters
-      like in latin_de 'ae' and 0xe4
-    */
-    return field_charset->coll->strnncollsp(field_charset,
-                                            (const uchar*) a_ptr, field_length,
-                                            (const uchar*) b_ptr,
-                                            field_length);
-  }
   if (field_charset->mbmaxlen != 1)
   {
     uint char_len= field_length/field_charset->mbmaxlen;
@@ -5091,6 +5080,17 @@
   }
   else
     a_len= b_len= field_length;
+
+  if (field_charset->strxfrm_multiply > 1)
+  {
+    /*
+      We have to remove end space to be able to compare multi-byte-characters
+      like in latin_de 'ae' and 0xe4
+    */
+    return field_charset->coll->strnncollsp(field_charset,
+                                            (const uchar*) a_ptr, a_len,
+                                            (const uchar*) b_ptr, b_len);
+  }
   return my_strnncoll(field_charset,(const uchar*) a_ptr, a_len,
                                     (const uchar*) b_ptr, b_len);
 }

--- 1.69/mysql-test/r/ctype_utf8.result	2006-03-30 01:50:50 +03:00
+++ 1.70/mysql-test/r/ctype_utf8.result	2006-04-26 14:33:50 +03:00
@@ -1124,3 +1124,16 @@
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 drop table t1;
+CREATE TABLE t1 (
+a int(10) unsigned NOT NULL auto_increment,
+b varchar(32) CHARACTER SET utf8 collate utf8_unicode_ci,
+c tinyint(3) unsigned NOT NULL default '0',
+PRIMARY KEY  (a)
+);
+INSERT INTO t1 VALUES (19, 'f1861d224d31df52586103f701e1b462', 0);
+CREATE INDEX b ON t1(b(10));
+UPDATE t1 SET c=1 WHERE b='f1861d224d31df52586103f701e1b462';
+select c from t1;
+c
+1
+drop table t1;

--- 1.71/mysql-test/t/ctype_utf8.test	2006-03-30 01:50:50 +03:00
+++ 1.72/mysql-test/t/ctype_utf8.test	2006-04-26 14:33:50 +03:00
@@ -927,3 +927,23 @@
 drop table t1;
 
 # End of 4.1 tests
+
+#
+# Bug#19080: Sub_part indexes on utf8 varchar fields are broken for UPDATE
+#
+
+CREATE TABLE t1 (
+  a int(10) unsigned NOT NULL auto_increment,
+  b varchar(32) CHARACTER SET utf8 collate utf8_unicode_ci,
+  c tinyint(3) unsigned NOT NULL default '0',
+  PRIMARY KEY  (a)
+);
+
+INSERT INTO t1 VALUES (19, 'f1861d224d31df52586103f701e1b462', 0);
+CREATE INDEX b ON t1(b(10));
+
+UPDATE t1 SET c=1 WHERE b='f1861d224d31df52586103f701e1b462';
+
+select c from t1;
+
+drop table t1;
Thread
bk commit into 4.1 tree (gkodinov:1.2459) BUG#19080kgeorge26 Apr