List:Commits« Previous MessageNext Message »
From:ingo Date:March 27 2007 10:49am
Subject:bk commit into 4.1 tree (istruewing:1.2609) BUG#24985
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of istruewing. When istruewing 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, 2007-03-27 10:49:48+02:00, istruewing@stripped +3 -0
  Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
              causes incorrect duplicate entries
  
  Keys for BTREE indexes on ENUM and SET columns of MEMORY tables
  with character set UTF8 were computed incorrectly. Many
  different column values got the same key value.
  
  Apart of possible performance problems, it made unique indexes
  of this type unusable because it rejected many different
  values as duplicates.
  
  The problem was that multibyte character detection was tried
  on the internal numeric column value. Many values were not
  identified as characters. Their key value became blank filled.
  
  Thanks to Alexander Barkov and Ramil Kalimullin for the patch,
  which sets the character set of ENUM and SET key segments to
  the pseudo binary character set.

  mysql-test/r/heap_btree.result@stripped, 2007-03-27 10:49:47+02:00, istruewing@stripped
+12 -0
    Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
                causes incorrect duplicate entries
    Added test result.

  mysql-test/t/heap_btree.test@stripped, 2007-03-27 10:49:47+02:00, istruewing@stripped
+17 -0
    Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
                causes incorrect duplicate entries
    Added test.

  sql/ha_heap.cc@stripped, 2007-03-27 10:49:47+02:00, istruewing@stripped +4 -1
    Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
                causes incorrect duplicate entries
    Set key segment charset to my_charset_bin for ENUM and SET
    columns.

# 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:	istruewing
# Host:	chilla.local
# Root:	/home/mydev/mysql-4.1-bug24985

--- 1.61/sql/ha_heap.cc	2007-03-27 10:49:52 +02:00
+++ 1.62/sql/ha_heap.cc	2007-03-27 10:49:52 +02:00
@@ -549,7 +549,10 @@ int ha_heap::create(const char *name, TA
       seg->start=   (uint) key_part->offset;
       seg->length=  (uint) key_part->length;
       seg->flag =   0;
-      seg->charset= field->charset();
+      if (field->flags & (ENUM_FLAG | SET_FLAG))
+        seg->charset= &my_charset_bin;
+      else
+        seg->charset= field->charset();
       if (field->null_ptr)
       {
 	seg->null_bit= field->null_bit;

--- 1.19/mysql-test/r/heap_btree.result	2007-03-27 10:49:52 +02:00
+++ 1.20/mysql-test/r/heap_btree.result	2007-03-27 10:49:52 +02:00
@@ -280,4 +280,16 @@ a
 1
 1
 drop table t1;
+CREATE TABLE t1 (
+c1 ENUM('1', '2'),
+UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 SET('1', '2'),
+UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
 End of 4.1 tests

--- 1.15/mysql-test/t/heap_btree.test	2007-03-27 10:49:52 +02:00
+++ 1.16/mysql-test/t/heap_btree.test	2007-03-27 10:49:52 +02:00
@@ -182,4 +182,21 @@ delete from t1 where a >= 2;
 select a from t1 order by a;
 drop table t1;
 
+#
+# Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE
+#             causes incorrect duplicate entries
+#
+CREATE TABLE t1 (
+  c1 ENUM('1', '2'),
+  UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+CREATE TABLE t1 (
+  c1 SET('1', '2'),
+  UNIQUE USING BTREE(c1)
+) ENGINE= MEMORY DEFAULT CHARSET= utf8;
+INSERT INTO t1 VALUES('1'), ('2');
+DROP TABLE t1;
+
 --echo End of 4.1 tests
Thread
bk commit into 4.1 tree (istruewing:1.2609) BUG#24985ingo27 Mar