summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <ram@gw.mysql.r18.ru>2004-12-02 14:34:53 +0400
committerunknown <ram@gw.mysql.r18.ru>2004-12-02 14:34:53 +0400
commit53fd2fda07df107f75a52e4be26efe2f3c0ba7b9 (patch)
tree2ed178727531457e5fd3bac01e6b654c761b978c
parentfff5c910e59f91f81ca14e756c21f22c186a331c (diff)
downloadmariadb-git-53fd2fda07df107f75a52e4be26efe2f3c0ba7b9.tar.gz
A fix (bug #6878: Crash with engine=memory).
heap/hp_open.c: A fix (bug #6878: Crash with engine=memory). Record length should be >= sizeof(byte*).
-rw-r--r--heap/hp_open.c7
-rw-r--r--mysql-test/r/heap.result9
-rw-r--r--mysql-test/t/heap.test11
3 files changed, 27 insertions, 0 deletions
diff --git a/heap/hp_open.c b/heap/hp_open.c
index 3bf2881667a..9cb087e3bad 100644
--- a/heap/hp_open.c
+++ b/heap/hp_open.c
@@ -41,6 +41,13 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
{
DBUG_PRINT("info",("Initializing new table"));
implicit_emptied= 1;
+
+ /*
+ We have to store sometimes byte* del_link in records,
+ so the record length should be at least sizeof(byte*)
+ */
+ set_if_bigger(reclength, sizeof (byte*));
+
for (i=key_segs=max_length=0 ; i < keys ; i++)
{
key_segs+= keydef[i].keysegs;
diff --git a/mysql-test/r/heap.result b/mysql-test/r/heap.result
index 11958f0a619..ef64c3a562f 100644
--- a/mysql-test/r/heap.result
+++ b/mysql-test/r/heap.result
@@ -227,3 +227,12 @@ SELECT MAX(job_title_id) FROM job_titles;
MAX(job_title_id)
NULL
DROP TABLE job_titles;
+create table t1(a char(2)) type=heap;
+insert into t1 values (NULL), (NULL);
+delete from t1 where a is null;
+insert into t1 values ('2'), ('3');
+select * from t1;
+a
+3
+2
+drop table t1;
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index 87518798a36..943910b7872 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -161,3 +161,14 @@ CREATE TABLE `job_titles` (
SELECT MAX(job_title_id) FROM job_titles;
DROP TABLE job_titles;
+
+#
+# Bug #6878: a problem with small length records
+#
+
+create table t1(a char(2)) type=heap;
+insert into t1 values (NULL), (NULL);
+delete from t1 where a is null;
+insert into t1 values ('2'), ('3');
+select * from t1;
+drop table t1;