1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Bug 27122803 - BACKPORT FIX FOR BUG 25899959 TO MYSQL-5.7

Merge a test case and a code change from MySQL 5.7.22.
There was no commit message, but a test case was included.
d3ec326bcd

There is no Bug 25899959 mentioned in the MySQL 8.0.11 history.
Based on the number, it should have been filed before August 2017.
Maybe it was initially fixed in a not-yet-public MySQL 9.0 branch?

The code change differs from MySQL 5.7, because the mbminmaxlen
were split in MariaDB in MDEV-7049.
This commit is contained in:
Marko Mäkelä
2018-05-14 23:22:59 +03:00
parent 4d2a36e8bc
commit 2b24b04220
3 changed files with 30 additions and 0 deletions

View File

@@ -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
DROP TABLE t1;
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;

View File

@@ -224,3 +224,11 @@ VIRTUAL, ADD UNIQUE index idx (col1), algorithm=inplace;
DROP TABLE t1;
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;

View File

@@ -4385,6 +4385,15 @@ prepare_inplace_alter_table_dict(
if (ha_alter_info->handler_flags
& 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*>(
mem_heap_alloc(ctx->heap, sizeof *add_v));
add_v->n_v_col = ctx->num_to_add_vcol;