mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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.
This commit is contained in:
@ -45,7 +45,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||||
INSERT INTO t1 values (1,'abba');
|
INSERT INTO t1 values (1,'abba');
|
||||||
CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
|
CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
|
||||||
ERROR 42000: Unknown storage 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 sql_mode='';
|
||||||
SET SESSION enforce_storage_engine=MyISAM;
|
SET SESSION enforce_storage_engine=MyISAM;
|
||||||
select @@session.enforce_storage_engine;
|
select @@session.enforce_storage_engine;
|
||||||
|
@ -26,7 +26,7 @@ CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=MyISA
|
|||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
INSERT INTO t1 values (1,'abba');
|
INSERT INTO t1 values (1,'abba');
|
||||||
|
|
||||||
--error 1286
|
--error ER_OPTION_PREVENTS_STATEMENT
|
||||||
CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
|
CREATE TABLE t2 (c1 INT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=Memory;
|
||||||
|
|
||||||
SET SESSION sql_mode='';
|
SET SESSION sql_mode='';
|
||||||
|
@ -11,5 +11,5 @@ t1 CREATE TABLE `t1` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||||
set session sql_mode='no_engine_substitution';
|
set session sql_mode='no_engine_substitution';
|
||||||
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
||||||
ERROR 42000: Unknown storage engine 'MEMORY'
|
ERROR HY000: The MariaDB server is running with the NO_ENGINE_SUBSTITUTION option so it cannot execute this statement
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -2,6 +2,6 @@ SET SQL_MODE="";
|
|||||||
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
set session sql_mode='no_engine_substitution';
|
set session sql_mode='no_engine_substitution';
|
||||||
--error 1286
|
--error ER_OPTION_PREVENTS_STATEMENT
|
||||||
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -12304,8 +12304,7 @@ bool check_engine(THD *thd, const char *db_name,
|
|||||||
{
|
{
|
||||||
if (no_substitution)
|
if (no_substitution)
|
||||||
{
|
{
|
||||||
const char *engine_name= ha_resolve_storage_engine_name(req_engine);
|
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "NO_ENGINE_SUBSTITUTION");
|
||||||
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), engine_name);
|
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
*new_engine= enf_engine;
|
*new_engine= enf_engine;
|
||||||
|
Reference in New Issue
Block a user