summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2007-03-27 17:59:49 +0200
committerunknown <istruewing@chilla.local>2007-03-27 17:59:49 +0200
commit548aad2578670f1ad9af2efa38f9a4d63f535810 (patch)
tree488f8a4e87714bd4ea3abfe31971540c3ef4162e
parentfa82ebd2d650fe92119ac72169460b80da84e60f (diff)
parent5e0ce03954693c5160feeebd475b048f8b6b2497 (diff)
downloadmariadb-git-548aad2578670f1ad9af2efa38f9a4d63f535810.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-engines
into chilla.local:/home/mydev/mysql-5.1-bug24985 storage/myisam/ha_myisam.cc: Auto merged mysql-test/r/heap_btree.result: Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE causes incorrect duplicate entries Manual merge from 5.0 mysql-test/t/heap_btree.test: Bug#24985 - UTF8 ENUM primary key on MEMORY using BTREE causes incorrect duplicate entries Manual merge from 5.0
-rw-r--r--mysql-test/r/heap_btree.result12
-rw-r--r--mysql-test/t/heap_btree.test17
-rw-r--r--storage/heap/ha_heap.cc5
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 18d3dab1b06..ab4b892170a 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -295,6 +295,18 @@ A 1
B 0
C 0
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
CREATE TABLE t1(val INT, KEY USING BTREE(val)) ENGINE=memory;
INSERT INTO t1 VALUES(0);
diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test
index 8e745d7646d..a8c0c5ce353 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -196,6 +196,23 @@ UPDATE t1 SET c2= c2 + 1 WHERE c1 = 'A';
SELECT * FROM t1;
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
#
diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc
index f2caa7e6d18..02448eb3aa2 100644
--- a/storage/heap/ha_heap.cc
+++ b/storage/heap/ha_heap.cc
@@ -627,7 +627,10 @@ int ha_heap::create(const char *name, TABLE *table_arg,
seg->length= (uint) key_part->length;
seg->flag= key_part->key_part_flag;
- 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;