summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoristruewing@chilla.local <>2007-03-27 10:54:37 +0200
committeristruewing@chilla.local <>2007-03-27 10:54:37 +0200
commitef1dec00c4a038e866a01db7ba6c264315ddd6ed (patch)
tree6727921791dd6b4d238f363aa5f6dd0523671db7
parent4e62cae0169feb79752b7bd784a405b8aa1bf21a (diff)
parent8934e4f3cc2bdd6c4a24edd0cc6c96ee2325b0dc (diff)
downloadmariadb-git-ef1dec00c4a038e866a01db7ba6c264315ddd6ed.tar.gz
Merge chilla.local:/home/mydev/mysql-4.1-bug24985
into chilla.local:/home/mydev/mysql-5.0-bug24985
-rw-r--r--mysql-test/r/heap_btree.result12
-rw-r--r--mysql-test/t/heap_btree.test18
-rw-r--r--sql/ha_heap.cc5
3 files changed, 34 insertions, 1 deletions
diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result
index 5b9c7f2244f..cc22e9405ed 100644
--- a/mysql-test/r/heap_btree.result
+++ b/mysql-test/r/heap_btree.result
@@ -280,6 +280,18 @@ 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
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 03ba8661a3c..14b1779bd1a 100644
--- a/mysql-test/t/heap_btree.test
+++ b/mysql-test/t/heap_btree.test
@@ -204,4 +204,22 @@ CREATE TABLE t1 (a INT, UNIQUE USING BTREE(a)) ENGINE=MEMORY;
INSERT INTO t1 VALUES(NULL),(NULL);
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
--echo End of 5.0 tests
diff --git a/sql/ha_heap.cc b/sql/ha_heap.cc
index d1a931b07f2..8838aa99c1a 100644
--- a/sql/ha_heap.cc
+++ b/sql/ha_heap.cc
@@ -604,7 +604,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;