1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-31822 ALTER TABLE ENGINE=x started failing instead of producing warning on unsupported TRANSACTIONAL=1

make TRANSACTIONAL table option behave similar to other engine-defined
table options. If the engine doesn't suport it:
* if specified expicitly in CREATE or ALTER - it's ER_UNKNOWN_OPTION
* an error or a warning depending on sql_mode IGNORE_BAD_TABLE_OPTIONS
* in ALTER TABLE from the engine that suppors it to the engine that
  doesn't - silently preserved (no warning)
* it is commented out in SHOW CREATE unless IGNORE_BAD_TABLE_OPTIONS
This commit is contained in:
Sergei Golubchik
2023-08-01 21:40:18 +02:00
parent da09ae05a9
commit 61acb43689
11 changed files with 177 additions and 34 deletions

View File

@ -1,7 +1,3 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
SET @OLD_SQL_MODE=@@SQL_MODE;
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
@ -66,3 +62,52 @@ SET SQL_MODE='';
create table t1 (a int fkey=vvv, key akey (a) dff=vvv) tkey1=1v1;
SET @@SQL_MODE=@OLD_SQL_MODE;
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # MDEV-31822 ALTER TABLE ENGINE=x started failing instead of producing warning on unsupported TRANSACTIONAL=1
--echo #
create table t0 (a int) transactional=0 engine=aria;
create table t1 (a int) transactional=1 engine=aria;
create table t2 (a int) transactional=default engine=aria;
show create table t0;
show create table t1;
show create table t2;
alter table t0 engine=myisam;
alter table t1 engine=myisam;
alter table t2 engine=myisam;
show create table t0;
show create table t1;
show create table t2;
--error ER_UNKNOWN_OPTION
alter table t0 engine=myisam transactional=0;
--error ER_UNKNOWN_OPTION
alter table t1 engine=myisam transactional=1;
--error ER_UNKNOWN_OPTION
alter table t2 engine=myisam transactional=default;
set sql_mode=IGNORE_BAD_TABLE_OPTIONS;
alter table t0 engine=myisam transactional=0;
alter table t1 engine=myisam transactional=1;
alter table t2 engine=myisam transactional=default;
show create table t0;
show create table t1;
show create table t2;
drop table t0,t1,t2;
# same behavior for other unknown options:
create table t1 (a int) foo=bar;
show create table t1;
set sql_mode=default;
show create table t1;
--error ER_UNKNOWN_OPTION
alter table t1 engine=aria bar=foo;
alter table t1 engine=aria;
show create table t1;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #