summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index a2dc5c97aeb..f3e8ebb98b3 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -10728,13 +10728,18 @@ bool check_engine(THD *thd, const char *db_name,
if (!*new_engine)
DBUG_RETURN(true);
- /* Enforced storage engine should not be used in
- ALTER TABLE that does not use explicit ENGINE = x to
- avoid unwanted unrelated changes.*/
- if (!(thd->lex->sql_command == SQLCOM_ALTER_TABLE &&
- !(create_info->used_fields & HA_CREATE_USED_ENGINE)))
- enf_engine= thd->variables.enforced_table_plugin ?
- plugin_hton(thd->variables.enforced_table_plugin) : NULL;
+ /*
+ Enforced storage engine should not be used in ALTER TABLE that does not
+ use explicit ENGINE = x to avoid unwanted unrelated changes. It should not
+ be used in CREATE INDEX too.
+ */
+ if (!((thd->lex->sql_command == SQLCOM_ALTER_TABLE &&
+ !(create_info->used_fields & HA_CREATE_USED_ENGINE)) ||
+ thd->lex->sql_command == SQLCOM_CREATE_INDEX))
+ {
+ plugin_ref enf_plugin= thd->variables.enforced_table_plugin;
+ enf_engine= enf_plugin ? plugin_hton(enf_plugin) : NULL;
+ }
if (enf_engine && enf_engine != *new_engine)
{