summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-06-24 14:54:28 +0200
committerunknown <ingo@mysql.com>2004-06-24 14:54:28 +0200
commit4ea8ef98d2e419355618bc6cfa0be5407b271486 (patch)
treebeb44ebd0753758abb89605e77b2cc6a647f308e /mysql-test/t
parentd3aad3c0a12317b4f0ac420279f157c8c9ced935 (diff)
downloadmariadb-git-4ea8ef98d2e419355618bc6cfa0be5407b271486.tar.gz
bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash.
Added put_length() to get_length() and unpack_key() to pack_key(). Keys were packed with the minimum size of the length field for the key part and unpacked with length size of the base column. For the purpose of optimal key packing we have the method pack_key(), while rows are packed with pack(). Now keys are unpacked with unpack_key() and no longer with unpack() which is used for rows. mysql-test/r/bdb.result: bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash. Added the test case results. mysql-test/t/bdb.test: bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash. Added the test case. sql/field.cc: bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash. Added put_length() to get_length() and unpack_key() to pack_key(). Keys were packed with the minimum size of the length field for the key part and unpacked with length size of the base column. For the purpose of optimal key packing we have the method pack_key(), while rows are packed with pack(). Now keys are unpacked with unpack_key() and no longer with unpack() which is used for rows. sql/field.h: bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash. Added put_length() to get_length() and unpack_key() to pack_key(). The default implementation simply calls unpack() for those field types that don't need a special key unpacking. sql/ha_berkeley.cc: bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash. Now keys are unpacked with unpack_key() and no longer with unpack() which is used for rows. For most field types, however, this simply calls unpack().
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/bdb.test19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/t/bdb.test b/mysql-test/t/bdb.test
index 4b490052535..504a24a5c17 100644
--- a/mysql-test/t/bdb.test
+++ b/mysql-test/t/bdb.test
@@ -829,3 +829,22 @@ alter table t1 modify a char(10) binary;
explain select a from t1;
select a from t1;
drop table t1;
+
+#
+# bug#2686 - index_merge select on BerkeleyDB table with varchar PK causes mysqld to crash
+#
+
+create table t1(
+ pk1 text not null, pk2 text not null, pk3 char(4),
+ key1 int, key2 int,
+ primary key(pk1(4), pk2(4), pk3), key(key1), key(key2)
+) engine=bdb;
+insert into t1 values (concat('aaa-', repeat('A', 4000)),
+ concat('eee-', repeat('e', 4000)), 'a++a', 1, 1);
+insert into t1 values (concat('bbb-', repeat('B', 4000)),
+ concat('ggg-', repeat('G', 4000)), 'b++b', 1, 1);
+select substring(pk1, 1, 4), substring(pk1, 4001),
+ substring(pk2, 1, 4), substring(pk2, 4001), pk3, key1, key2
+ from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
+drop table t1;
+