Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

bk commit into 4.1 tree (kaa:1.2685) BUG#28878

From: Alexey Kopytov <alexeyk(at)mysql.com>
Date: Thu Oct 04 2007 - 06:22:38 EDT


Below is the list of changes that have just been committed into a local 4.1 repository of kaa. When kaa 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.2685, 2007-10-04 14:22:35+04:00, kaa@polly.(none) +3 -0   Backport of the 5.0 patch to 4.1   

  Bug#28878: InnoDB tables with UTF8 character set and indexes cause wrong result for DML   When making key reference buffers over CHAR fields whitespace (0x20) must be used to fill in the remaining space in the field's buffer. This is what Field_string::store() does. Fixed Field_string::get_key_image() to do the same.

  mysql-test/r/innodb_mysql.result@1.10, 2007-10-04 14:22:30+04:00, kaa@polly.(none) +36 -0     Bug#28878: test case

  mysql-test/t/innodb_mysql.test@1.10, 2007-10-04 14:22:30+04:00, kaa@polly.(none) +32 -0     Bug#28878: test case

  sql/field.cc@1.237, 2007-10-04 14:22:30+04:00, kaa@polly.(none) +2 -1     Bug#28878: Fill with space instead of binary zeros.

diff -Nrup a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result

--- a/mysql-test/r/innodb_mysql.result	2007-05-15 10:55:16 +04:00

+++ b/mysql-test/r/innodb_mysql.result 2007-10-04 14:22:30 +04:00
@@ -182,4 +182,40 @@ t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVk id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
 DROP TABLE t1;
+CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES ('uk'),('bg');
+SELECT * FROM t1 WHERE a = 'uk';
+a
+uk
+DELETE FROM t1 WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+UPDATE t1 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES ('uk'),('bg');
+SELECT * FROM t2 WHERE a = 'uk';
+a
+uk
+DELETE FROM t2 WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+INSERT INTO t2 VALUES ('uk');
+UPDATE t2 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
+INSERT INTO t3 VALUES ('uk'),('bg');
+SELECT * FROM t3 WHERE a = 'uk';
+a
+uk
+DELETE FROM t3 WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+INSERT INTO t3 VALUES ('uk');
+UPDATE t3 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+DROP TABLE t1,t2,t3;

 End of 4.1 tests
diff -Nrup a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
--- a/mysql-test/t/innodb_mysql.test	2007-05-15 10:55:16 +04:00

+++ b/mysql-test/t/innodb_mysql.test 2007-10-04 14:22:30 +04:00
@@ -216,4 +216,36 @@ t1.a4='UNcT5pIde4I6c2SheTo4gt92OV1jgJCVk  

 DROP TABLE t1;  

Do you need help?X

+#
+# Bug #28878: InnoDB tables with UTF8 character set and indexes cause wrong result for DML
+#
+
+CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES ('uk'),('bg');
+SELECT * FROM t1 WHERE a = 'uk';
+DELETE FROM t1 WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+UPDATE t1 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+
+CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES ('uk'),('bg');
+SELECT * FROM t2 WHERE a = 'uk';
+DELETE FROM t2 WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+INSERT INTO t2 VALUES ('uk');
+UPDATE t2 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+
+CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
+INSERT INTO t3 VALUES ('uk'),('bg');
+SELECT * FROM t3 WHERE a = 'uk';
+DELETE FROM t3 WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+INSERT INTO t3 VALUES ('uk');
+UPDATE t3 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+
+DROP TABLE t1,t2,t3;
+

 --echo End of 4.1 tests
diff -Nrup a/sql/field.cc b/sql/field.cc

--- a/sql/field.cc	2007-04-29 03:15:46 +04:00

+++ b/sql/field.cc 2007-10-04 14:22:30 +04:00
@@ -5211,7 +5211,8 @@ uint Field_string::get_key_image(char *b length / field_charset->mbmaxlen);
   memcpy(buff, ptr, bytes);
   if (bytes < length)
- bzero(buff + bytes, length - bytes);
+ field_charset->cset->fill(field_charset, buff + bytes, length - bytes,
+ ' ');

   return bytes;
 }  

-- 
MySQL Code Commits Mailing List
For list archives: 
http://lists.mysql.com/commits
To unsubscribe:    
http://lists.mysql.com/commits?unsub=lists@pantek.com
Received on Thu Oct 4 06:24:05 2007

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:54:36 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library