diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3840e29f04a..9de4ef1a1ac 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1779,8 +1779,6 @@ int mysql_discard_or_import_tablespace(THD *thd, DBUG_RETURN(-1); } - thd->tablespace_op=FALSE; - error=table->file->discard_or_import_tablespace(discard); thd->proc_info="end"; @@ -1806,6 +1804,7 @@ int mysql_discard_or_import_tablespace(THD *thd, } err: close_thread_tables(thd); + thd->tablespace_op=FALSE; if (error == 0) { send_ok(thd); DBUG_RETURN(0); @@ -1848,6 +1847,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name, mysql_ha_closeall(thd, table_list); + /* DISCARD/IMPORT TABLESPACE is always alone in an ALTER TABLE */ if (tablespace_op != NO_TABLESPACE_OP) DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, tablespace_op)); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index f917e4ec027..569fa984973 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -4515,6 +4515,7 @@ keyword: | DELAY_KEY_WRITE_SYM {} | DES_KEY_FILE {} | DIRECTORY_SYM {} + | DISCARD {} | DO_SYM {} | DUAL_SYM {} | DUMPFILE {} @@ -4546,6 +4547,7 @@ keyword: | HOSTS_SYM {} | HOUR_SYM {} | IDENTIFIED_SYM {} + | IMPORT {} | INDEXES {} | ISOLATION {} | ISAM_SYM {} @@ -4654,6 +4656,7 @@ keyword: | SUBDATE_SYM {} | SUBJECT_SYM {} | SUPER_SYM {} + | TABLESPACE {} | TEMPORARY {} | TEXT_SYM {} | TRANSACTION_SYM {}