Skip to content

Commit

Permalink
MDEV-31601 Some ALTER TABLEs fail ... with a wrong error message
Browse files Browse the repository at this point in the history
Report correct algorithm in the error message.
  • Loading branch information
FooBarrior authored and vuvova committed Aug 15, 2023
1 parent 8a165d7 commit 2cecb5a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
13 changes: 13 additions & 0 deletions mysql-test/main/alter_table_online.result
Expand Up @@ -206,3 +206,16 @@ drop table t;
create table t (a int, b int, c char(8), key(a,b,c));
alter table t modify c int auto_increment key, algorithm=copy;
drop table t;
# MDEV-31601 Some ALTER TABLE .. fail when they worked before, and with
# a wrong error message
create table t (a int) engine=aria;
insert into t values (1),(2);
alter table t algorithm=nocopy, order by a;
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=COPY
alter table t engine=myisam, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
drop table t;
create temporary table t (f int);
alter table t force, algorithm=instant;
ERROR 0A000: ALGORITHM=INSTANT is not supported for this operation. Try ALGORITHM=COPY
drop table t;
15 changes: 15 additions & 0 deletions mysql-test/main/alter_table_online.test
Expand Up @@ -207,3 +207,18 @@ drop table t;
create table t (a int, b int, c char(8), key(a,b,c));
alter table t modify c int auto_increment key, algorithm=copy;
drop table t;

--echo # MDEV-31601 Some ALTER TABLE .. fail when they worked before, and with
--echo # a wrong error message
create table t (a int) engine=aria;
insert into t values (1),(2);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t algorithm=nocopy, order by a;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t engine=myisam, algorithm=inplace;
drop table t;

create temporary table t (f int);
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t force, algorithm=instant;
drop table t;
2 changes: 1 addition & 1 deletion mysql-test/main/mysql57_virtual.result
Expand Up @@ -14,7 +14,7 @@ a b c
1 2 4
2 3 5
alter online table mysql57_virtual comment "I am now a MariaDB table", algorithm=nocopy;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=COPY
alter table mysql57_virtual comment "I am now a MariaDB table";
SHOW CREATE TABLE mysql57_virtual;
Table Create Table
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_table.cc
Expand Up @@ -10690,7 +10690,7 @@ do_continue:;
if (alter_info->algorithm_is_nocopy(thd))
{
my_error(ER_ALTER_OPERATION_NOT_SUPPORTED, MYF(0),
"ALGORITHM=INPLACE", "ALGORITHM=COPY");
alter_info->algorithm_clause(thd), "ALGORITHM=COPY");
DBUG_RETURN(true);
}

Expand Down

0 comments on commit 2cecb5a

Please sign in to comment.