mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 09:14:17 +01:00
4cf3a1b1ad
The server doesn't use the enforced storage engine in ALTER TABLE without ENGINE clause to avoid an unwanted engine change. However, the server tries to use the enforced engine in CREATE INDEX. As a result, the false positive error is raised. The server should not apply the enforced engine in CREATE INDEX too.
169 lines
5.7 KiB
Text
169 lines
5.7 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 42000: Unknown storage engine 'MEMORY'
|
|
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;
|