BUG#26080 - Memory Storage engine not working properly

Extending varchar column length with ALTER TABLE may result in unusable
memory table.

The problem is that we use fast ALTER TABLE in this case, which is not
supported by now.

This is fixed by refusing fast ALTER TABLE when extending varchar column.
In other words force copy of a table during ALTER TABLE.

Affects MEMORY tables in 5.1 only.
parent 36c9f410
......@@ -731,3 +731,10 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
COUNT(*)
2
DROP TABLE t1;
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
INSERT INTO t1 VALUES('', 0);
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
SELECT c2 FROM t1;
c2
0
DROP TABLE t1;
......@@ -471,3 +471,12 @@ SELECT COUNT(*) FROM t1 WHERE c=REPEAT('a',256);
DROP TABLE t1;
# End of 5.0 tests
#
# BUG#26080 - Memory Storage engine not working properly
#
CREATE TABLE t1(c1 VARCHAR(100), c2 INT) ENGINE=MEMORY;
INSERT INTO t1 VALUES('', 0);
ALTER TABLE t1 MODIFY c1 VARCHAR(101);
SELECT c2 FROM t1;
DROP TABLE t1;
......@@ -703,9 +703,10 @@ bool ha_heap::check_if_incompatible_data(HA_CREATE_INFO *info,
uint table_changes)
{
/* Check that auto_increment value was not changed */
if ((table_changes != IS_EQUAL_YES &&
info->used_fields & HA_CREATE_USED_AUTO) &&
info->auto_increment_value != 0)
if ((info->used_fields & HA_CREATE_USED_AUTO &&
info->auto_increment_value != 0) ||
table_changes == IS_EQUAL_NO ||
table_changes & IS_EQUAL_PACK_LENGTH) // Not implemented yet
return COMPATIBLE_DATA_NO;
return COMPATIBLE_DATA_YES;
}
......
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