Commit 9be800a4 authored by zkasheff's avatar zkasheff

refs #61, make blob expansion a non-hot operation

parent 4780c8bb
......@@ -27,6 +27,7 @@ CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a TEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a BLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a TEXT NOT NULL;
......@@ -44,11 +45,13 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a TEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a BLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
......@@ -66,11 +69,13 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
......@@ -88,6 +93,7 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
ALTER TABLE t CHANGE COLUMN a a TINYTEXT NULL;
......@@ -139,6 +145,7 @@ CREATE TABLE t (a BLOB NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
......@@ -156,11 +163,13 @@ CREATE TABLE t (a BLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
......@@ -178,6 +187,7 @@ CREATE TABLE t (a BLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a MEDIUMBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a TINYTEXT NULL;
......@@ -253,6 +263,7 @@ CREATE TABLE t (a MEDIUMBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a MEDIUMBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
......@@ -270,6 +281,7 @@ CREATE TABLE t (a MEDIUMBLOB NOT NULL);
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this XYZ version
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
ERROR 42000: Table 't' uses an extension that doesn't exist in this MySQL version
DROP TABLE t;
CREATE TABLE t (a LONGBLOB NULL);
ALTER TABLE t CHANGE COLUMN a a TINYTEXT NULL;
......
......@@ -37,6 +37,7 @@ CREATE TABLE t (a TINYBLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a TEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a BLOB NULL;
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
......@@ -59,12 +60,14 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a TEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a BLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NULL;
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
......@@ -87,12 +90,14 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
DROP TABLE t;
CREATE TABLE t (a TINYBLOB NULL);
......@@ -115,6 +120,7 @@ CREATE TABLE t (a TINYBLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
......@@ -181,6 +187,7 @@ CREATE TABLE t (a BLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NULL;
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
......@@ -203,12 +210,14 @@ CREATE TABLE t (a BLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMTEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a MEDIUMBLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
DROP TABLE t;
CREATE TABLE t (a BLOB NULL);
......@@ -231,6 +240,7 @@ CREATE TABLE t (a BLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a MEDIUMBLOB NULL);
......@@ -329,6 +339,7 @@ CREATE TABLE t (a MEDIUMBLOB NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NULL;
DROP TABLE t;
CREATE TABLE t (a MEDIUMBLOB NULL);
......@@ -351,6 +362,7 @@ CREATE TABLE t (a MEDIUMBLOB NOT NULL);
--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGTEXT NOT NULL;
--error ER_UNSUPPORTED_EXTENSION
ALTER TABLE t CHANGE COLUMN a a LONGBLOB NOT NULL;
DROP TABLE t;
CREATE TABLE t (a LONGBLOB NULL);
......
......@@ -1017,19 +1017,6 @@ static bool change_field_type_is_supported(Field *old_field, Field *new_field, T
// varchar(X) -> varchar(Y) and varbinary(X) -> varbinary(Y) expansion where X < 256 <= Y
// the ALTER_COLUMN_TYPE handler flag is set for these cases
return change_varchar_length_is_supported(old_field, new_field, table, altered_table, ha_alter_info, ctx);
} else if (old_type == MYSQL_TYPE_BLOB) {
// blob -> longer blob
if (new_type == MYSQL_TYPE_BLOB && old_field->binary() && new_field->binary() &&
old_field->pack_length() <= new_field->pack_length()) {
return true;
}
// text -> longer text
if (new_type == MYSQL_TYPE_BLOB && !old_field->binary() && !new_field->binary() &&
old_field->pack_length() <= new_field->pack_length() &&
old_field->charset()->number == new_field->charset()->number) {
return true;
}
return false;
} else
return false;
}
......
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