Commit 384ec03e authored by Yuchen Pei's avatar Yuchen Pei

MDEV-34421 Check the SQL command when resolving storage engine

ENGINE_SUBSTITUTION only applies to CREATE TABLE and ALTER TABLE, and
Storage_engine_name::resolve_storage_engine_with_error() could be
called when executing any sql command.
parent 132270d3
......@@ -311,7 +311,9 @@ Storage_engine_name::resolve_storage_engine_with_error(THD *thd,
}
*ha= NULL;
if (thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
if ((thd_sql_command(thd) != SQLCOM_CREATE_TABLE &&
thd_sql_command(thd) != SQLCOM_ALTER_TABLE) ||
thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION)
{
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), m_storage_engine_name.str);
return true;
......
SET sql_mode='';
INSTALL SONAME 'ha_spider';
CREATE TABLE t (c INT) ENGINE=Spider PARTITION BY KEY(c) (PARTITION p);
UNINSTALL SONAME IF EXISTS 'ha_spider';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
INSERT INTO t SELECT 1;
ERROR 42000: Unknown storage engine 'SPIDER'
drop table t;
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
Note 1305 PLUGIN SPIDER_ALLOC_MEM does not exist
Note 1305 PLUGIN SPIDER_WRAPPER_PROTOCOLS does not exist
--source include/have_partition.inc
SET sql_mode='';
INSTALL SONAME 'ha_spider';
CREATE TABLE t (c INT) ENGINE=Spider PARTITION BY KEY(c) (PARTITION p);
UNINSTALL SONAME IF EXISTS 'ha_spider';
--error ER_UNKNOWN_STORAGE_ENGINE
INSERT INTO t SELECT 1;
drop table t;
--disable_query_log
--source ../../include/clean_up_spider.inc
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment