Commit 7ed27533 authored by ram@gw.mysql.r18.ru's avatar ram@gw.mysql.r18.ru

A fix (bug #6878: Crash with engine=memory).

parent 7219d2be
...@@ -41,6 +41,13 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef, ...@@ -41,6 +41,13 @@ HP_INFO *heap_open(const char *name, int mode, uint keys, HP_KEYDEF *keydef,
{ {
DBUG_PRINT("info",("Initializing new table")); DBUG_PRINT("info",("Initializing new table"));
implicit_emptied= 1; 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++) for (i=key_segs=max_length=0 ; i < keys ; i++)
{ {
key_segs+= keydef[i].keysegs; key_segs+= keydef[i].keysegs;
......
...@@ -227,3 +227,12 @@ SELECT MAX(job_title_id) FROM job_titles; ...@@ -227,3 +227,12 @@ SELECT MAX(job_title_id) FROM job_titles;
MAX(job_title_id) MAX(job_title_id)
NULL NULL
DROP TABLE job_titles; 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;
...@@ -161,3 +161,14 @@ CREATE TABLE `job_titles` ( ...@@ -161,3 +161,14 @@ CREATE TABLE `job_titles` (
SELECT MAX(job_title_id) FROM job_titles; SELECT MAX(job_title_id) FROM job_titles;
DROP TABLE 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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment