MDEV-16071 Server crashed in innobase_build_col_map /...

MDEV-16071 Server crashed in innobase_build_col_map / prepare_inplace_alter_table_dict or Assertion `tuple' failed in dtuple_get_nth_field upon altering table with virtual column

- Virtual column should be considered during innobase_build_col_map() to find out
whether the field changed from NULL to NOT NULL.
parent 8a941bad
......@@ -73,3 +73,9 @@ f1 b
ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), algorithm=INPLACE;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: cannot convert NULL to non-constant DEFAULT. Try ALGORITHM=COPY
DROP TABLE t1;
CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1;
......@@ -56,3 +56,11 @@ SELECT * FROM t1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1 CHANGE b b TINYINT NOT NULL DEFAULT if(unix_timestamp()>1,1000,0), algorithm=INPLACE;
DROP TABLE t1;
CREATE TABLE t1(a INT, v INT AS (a), c INT, d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 DROP COLUMN c, CHANGE COLUMN e e INT NOT NULL, ALGORITHM=INPLACE;
DROP TABLE t1;
CREATE TABLE t1 (a INT, v INT AS (a), d INT NOT NULL, e INT) ENGINE=InnoDB;
ALTER TABLE t1 FORCE, ALGORITHM=INPLACE;
DROP TABLE t1;
......@@ -3282,13 +3282,13 @@ innobase_build_col_map(
if (new_field->field == field) {
const Field* altered_field =
altered_table->field[i];
altered_table->field[i + num_v];
if (field->real_maybe_null()
&& !altered_field->real_maybe_null()) {
innobase_build_col_map_add(
heap, dtuple_get_nth_field(
defaults, i),
defaults, i + num_v),
altered_field,
dict_table_is_comp(new_table));
}
......
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