summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se>2006-06-15 15:56:47 -0400
committerunknown <mikael@c-0409e253.1238-1-64736c10.cust.bredbandsbolaget.se>2006-06-15 15:56:47 -0400
commit6dd40f3e0ab74846d7793cc32065b4c2aa7741f5 (patch)
tree8d8741dcde54e87644432016cc4259370485d9aa /sql/sql_table.cc
parente846fb8945c96ae5424ba949e1d41e832ac26111 (diff)
downloadmariadb-git-6dd40f3e0ab74846d7793cc32065b4c2aa7741f5.tar.gz
BUG#20397: Crash when alter table t1 engine = x;
Review fixes sql/sql_table.cc: Review fixes
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 58d50727000..7e25c4848ca 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4993,17 +4993,20 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
old_db_type= table->s->db_type;
if (!create_info->db_type)
{
- if (create_info->used_fields & HA_CREATE_USED_ENGINE)
+ if (table->part_info &&
+ create_info->used_fields & HA_CREATE_USED_ENGINE)
{
/*
This case happens when the user specified
ENGINE = x where x is a non-existing storage engine
- We clear the flag and treat it the same way
- as if no storage engine was specified.
+ We set create_info->db_type to default_engine_type
+ to ensure we don't change underlying engine type
+ due to a erroneously given engine name.
*/
- create_info->used_fields^= HA_CREATE_USED_ENGINE;
+ create_info->db_type= table->part_info->default_engine_type;
}
- create_info->db_type= old_db_type;
+ else
+ create_info->db_type= old_db_type;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE