summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/enforce_storage_engine_opt.result14
-rw-r--r--mysql-test/t/enforce_storage_engine_opt.opt1
-rw-r--r--mysql-test/t/enforce_storage_engine_opt.test6
-rw-r--r--sql/sql_plugin.cc3
4 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/r/enforce_storage_engine_opt.result b/mysql-test/r/enforce_storage_engine_opt.result
new file mode 100644
index 00000000000..a28461ef091
--- /dev/null
+++ b/mysql-test/r/enforce_storage_engine_opt.result
@@ -0,0 +1,14 @@
+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
+set session sql_mode='no_engine_substitution';
+create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
+ERROR 42000: Unknown storage engine 'MEMORY'
+drop table t1;
diff --git a/mysql-test/t/enforce_storage_engine_opt.opt b/mysql-test/t/enforce_storage_engine_opt.opt
new file mode 100644
index 00000000000..9f09b57e395
--- /dev/null
+++ b/mysql-test/t/enforce_storage_engine_opt.opt
@@ -0,0 +1 @@
+--enforce-storage-engine=myisam
diff --git a/mysql-test/t/enforce_storage_engine_opt.test b/mysql-test/t/enforce_storage_engine_opt.test
new file mode 100644
index 00000000000..82cc4117cdb
--- /dev/null
+++ b/mysql-test/t/enforce_storage_engine_opt.test
@@ -0,0 +1,6 @@
+create table t1 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
+show create table t1;
+set session sql_mode='no_engine_substitution';
+--error 1286
+create table t2 (c1 int primary key auto_increment, c2 varchar(10)) engine=memory;
+drop table t1;
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 85e2151d888..847669d84ea 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -3107,6 +3107,9 @@ void plugin_thdvar_init(THD *thd)
if (global_system_variables.tmp_table_plugin)
thd->variables.tmp_table_plugin=
intern_plugin_lock(NULL, global_system_variables.tmp_table_plugin);
+ if (global_system_variables.enforced_table_plugin)
+ thd->variables.enforced_table_plugin=
+ intern_plugin_lock(NULL, global_system_variables.enforced_table_plugin);
intern_plugin_unlock(NULL, old_table_plugin);
intern_plugin_unlock(NULL, old_tmp_table_plugin);
intern_plugin_unlock(NULL, old_enforced_table_plugin);