1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-8577: With enforce-storage-engine mysql_upgrade corrupts the schema:

ALTER TABLE should either bypass enforce-storage-engine, or mysql_upgrade
should refuse to run

Allow user to alter contents of existing table without enforcing
storage engine. However, enforce storage engine on ALTER TABLE
x ENGINE=y;
This commit is contained in:
Jan Lindström
2015-09-12 13:16:05 +03:00
parent 1e9ab68e4a
commit 9b577edd50
5 changed files with 144 additions and 2 deletions

View File

@@ -9818,14 +9818,21 @@ static bool check_engine(THD *thd, const char *db_name,
DBUG_ENTER("check_engine");
handlerton **new_engine= &create_info->db_type;
handlerton *req_engine= *new_engine;
handlerton *enf_engine= thd->variables.enforced_table_plugin ?
plugin_hton(thd->variables.enforced_table_plugin) : NULL;
handlerton *enf_engine= NULL;
bool no_substitution= thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION;
*new_engine= ha_checktype(thd, req_engine, no_substitution);
DBUG_ASSERT(*new_engine);
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;
if (enf_engine && enf_engine != *new_engine)
{
if (no_substitution)