Commit 2879fb08 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-16142: Merge one more fix from MySQL 5.7.22

This fix was initially missed, because there were multiple commits
with an empty message.
parents 4d2a36e8 2b24b042
...@@ -198,3 +198,16 @@ VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; ...@@ -198,3 +198,16 @@ VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: INPLACE ADD or DROP of virtual columns cannot be combined with other ALTER TABLE actions. Try ALGORITHM=COPY
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
#
# Bug 27122803 - BACKPORT FIX FOR BUG 25899959 TO MYSQL-5.7
#
CREATE TABLE t1 (col1 int(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE t1 ADD col2 char(21) AS (col1 * col1), ADD INDEX n (col2);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`col1` int(10) DEFAULT NULL,
`col2` char(21) GENERATED ALWAYS AS (`col1` * `col1`) VIRTUAL,
KEY `n` (`col2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
DROP TABLE t1;
...@@ -224,3 +224,11 @@ VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace; ...@@ -224,3 +224,11 @@ VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace;
DROP TABLE t1; DROP TABLE t1;
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
--echo #
--echo # Bug 27122803 - BACKPORT FIX FOR BUG 25899959 TO MYSQL-5.7
--echo #
CREATE TABLE t1 (col1 int(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE t1 ADD col2 char(21) AS (col1 * col1), ADD INDEX n (col2);
SHOW CREATE TABLE t1;
DROP TABLE t1;
...@@ -4385,6 +4385,15 @@ prepare_inplace_alter_table_dict( ...@@ -4385,6 +4385,15 @@ prepare_inplace_alter_table_dict(
if (ha_alter_info->handler_flags if (ha_alter_info->handler_flags
& Alter_inplace_info::ADD_INDEX) { & Alter_inplace_info::ADD_INDEX) {
for (ulint i = 0; i < ctx->num_to_add_vcol; i++) {
/* Set mbminmax for newly added column */
dict_col_t& col = ctx->add_vcol[i].m_col;
ulint mbminlen, mbmaxlen;
dtype_get_mblen(col.mtype, col.prtype,
&mbminlen, &mbmaxlen);
col.mbminlen = mbminlen;
col.mbmaxlen = mbmaxlen;
}
add_v = static_cast<dict_add_v_col_t*>( add_v = static_cast<dict_add_v_col_t*>(
mem_heap_alloc(ctx->heap, sizeof *add_v)); mem_heap_alloc(ctx->heap, sizeof *add_v));
add_v->n_v_col = ctx->num_to_add_vcol; add_v->n_v_col = ctx->num_to_add_vcol;
......
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