mariadb/mysql-test/main/enforce_storage_engine.result
Rucha Deodhar e14d2b7974 MDEV-8578: Wrong error code/message with enforce_storage_engine and
NO_ENGINE_SUBSTITUTION

Analysis:
When the error is hit, wrong error code is passed in my_error
Fix:
Pass a better error code.
2024-10-18 16:42:52 +05:30

169 lines
5.8 KiB
Text

set local sql_mode="";
set global sql_mode="";
drop table if exists t1;
SET SESSION enforce_storage_engine=MyISAM;
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
Warnings:
Note 1266 Using storage engine MyISAM for table 't1'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
INSERT INTO t1 values (1,'abba');
CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
ERROR HY000: The MariaDB server is running with the NO_ENGINE_SUBSTITUTION option so it cannot execute this statement
SET SESSION sql_mode='';
SET SESSION enforce_storage_engine=MyISAM;
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
select * from t1;
c1 c2
1 abba
drop table t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
SET SESSION enforce_storage_engine=FooBar;
ERROR 42000: Unknown storage engine 'FooBar'
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MyISAM
connect con1,localhost,user_1,,;
connection con1;
SET SESSION enforce_storage_engine=MyISAM;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
disconnect con1;
connection default;
SET SESSION enforce_storage_engine=NULL;
SET SESSION sql_mode='NO_ENGINE_SUBSTITUTION';
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
SET GLOBAL enforce_storage_engine=Memory;
SET SESSION sql_mode='';
connect con1,localhost,root,,;
connection con1;
select @@session.enforce_storage_engine;
@@session.enforce_storage_engine
MEMORY
select @@global.enforce_storage_engine;
@@global.enforce_storage_engine
MEMORY
CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10));
Warnings:
Note 1266 Using storage engine MEMORY for table 't1'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1;
connection default;
disconnect con1;
set global sql_mode=default;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;
CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t3 values (NULL, 'test');
SET SESSION enforce_storage_engine=Memory;
ALTER TABLE t3 ENGINE=MyISAM;
Warnings:
Note 1266 Using storage engine MEMORY for table 't3'
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t3;
SET SESSION enforce_storage_engine=NULL;
CREATE TABLE t3 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISAM;
INSERT INTO t3 values (NULL, 'test');
SET SESSION enforce_storage_engine=Memory;
ALTER TABLE t3 ADD COLUMN c3 INT;
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` varchar(10) DEFAULT NULL,
`c3` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t3;
#
# MDEV-21618 CREATE UNIQUE INDEX fails with "ERROR 1286 (42000): Unknown storage engine 'partition'"
#
SET SESSION enforce_storage_engine=MyISAM;
CREATE TABLE t4 (a INT) ENGINE=MyISAM PARTITION BY HASH(a);
CREATE INDEX x on t4 (a);
DROP TABLE t4;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;