Skip to content

Commit 2cecb5a

Browse files
FooBarriorvuvova
authored andcommitted
MDEV-31601 Some ALTER TABLEs fail ... with a wrong error message
Report correct algorithm in the error message.
1 parent 8a165d7 commit 2cecb5a

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

mysql-test/main/alter_table_online.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,16 @@ drop table t;
206206
create table t (a int, b int, c char(8), key(a,b,c));
207207
alter table t modify c int auto_increment key, algorithm=copy;
208208
drop table t;
209+
# MDEV-31601 Some ALTER TABLE .. fail when they worked before, and with
210+
# a wrong error message
211+
create table t (a int) engine=aria;
212+
insert into t values (1),(2);
213+
alter table t algorithm=nocopy, order by a;
214+
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=COPY
215+
alter table t engine=myisam, algorithm=inplace;
216+
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
217+
drop table t;
218+
create temporary table t (f int);
219+
alter table t force, algorithm=instant;
220+
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY
221+
drop table t;

mysql-test/main/alter_table_online.test

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,18 @@ drop table t;
207207
create table t (a int, b int, c char(8), key(a,b,c));
208208
alter table t modify c int auto_increment key, algorithm=copy;
209209
drop table t;
210+
211+
--echo # MDEV-31601 Some ALTER TABLE .. fail when they worked before, and with
212+
--echo # a wrong error message
213+
create table t (a int) engine=aria;
214+
insert into t values (1),(2);
215+
--error ER_ALTER_OPERATION_NOT_SUPPORTED
216+
alter table t algorithm=nocopy, order by a;
217+
--error ER_ALTER_OPERATION_NOT_SUPPORTED
218+
alter table t engine=myisam, algorithm=inplace;
219+
drop table t;
220+
221+
create temporary table t (f int);
222+
--error ER_ALTER_OPERATION_NOT_SUPPORTED
223+
alter table t force, algorithm=instant;
224+
drop table t;

mysql-test/main/mysql57_virtual.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ a b c
1414
1 2 4
1515
2 3 5
1616
alter online table mysql57_virtual comment "I am now a MariaDB table", algorithm=nocopy;
17-
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
17+
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=COPY
1818
alter table mysql57_virtual comment "I am now a MariaDB table";
1919
SHOW CREATE TABLE mysql57_virtual;
2020
Table Create Table

sql/sql_table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10690,7 +10690,7 @@ do_continue:;
1069010690
if (alter_info->algorithm_is_nocopy(thd))
1069110691
{
1069210692
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED, MYF(0),
10693-
"ALGORITHM=INPLACE", "ALGORITHM=COPY");
10693+
alter_info->algorithm_clause(thd), "ALGORITHM=COPY");
1069410694
DBUG_RETURN(true);
1069510695
}
1069610696

0 commit comments

Comments
 (0)