mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SQL: disable engine change [fixes #358]
This commit is contained in:
@ -22,6 +22,8 @@ t CREATE TABLE `t` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||||
alter table t add column y int;
|
alter table t add column y int;
|
||||||
ERROR HY000: Not allowed for versioned `test.t`. Change `versioning_alter_history` to proceed with ALTER.
|
ERROR HY000: Not allowed for versioned `test.t`. Change `versioning_alter_history` to proceed with ALTER.
|
||||||
|
alter table t engine innodb;
|
||||||
|
ERROR HY000: Not allowed for versioned `test.t`. Change to/from native versioning engine is prohibited.
|
||||||
alter table t drop system versioning;
|
alter table t drop system versioning;
|
||||||
show create table t;
|
show create table t;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
|
@ -12,6 +12,8 @@ show create table t;
|
|||||||
|
|
||||||
--error ER_VERS_ALTER_NOT_ALLOWED
|
--error ER_VERS_ALTER_NOT_ALLOWED
|
||||||
alter table t add column y int;
|
alter table t add column y int;
|
||||||
|
--error ER_VERS_ALTER_ENGINE_PROHIBITED
|
||||||
|
alter table t engine innodb;
|
||||||
|
|
||||||
alter table t drop system versioning;
|
alter table t drop system versioning;
|
||||||
show create table t;
|
show create table t;
|
||||||
|
@ -7848,6 +7848,9 @@ WARN_VERS_PART_NON_HISTORICAL
|
|||||||
ER_VERS_ALTER_NOT_ALLOWED
|
ER_VERS_ALTER_NOT_ALLOWED
|
||||||
eng "Not allowed for versioned `%s.%s`. Change `versioning_alter_history` to proceed with ALTER."
|
eng "Not allowed for versioned `%s.%s`. Change `versioning_alter_history` to proceed with ALTER."
|
||||||
|
|
||||||
|
ER_VERS_ALTER_ENGINE_PROHIBITED
|
||||||
|
eng "Not allowed for versioned `%s.%s`. Change to/from native versioning engine is prohibited."
|
||||||
|
|
||||||
ER_VERS_RANGE_PROHIBITED
|
ER_VERS_RANGE_PROHIBITED
|
||||||
eng "SYSTEM_TIME range selector is prohibited"
|
eng "SYSTEM_TIME range selector is prohibited"
|
||||||
|
|
||||||
|
@ -8842,11 +8842,21 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
|
|||||||
bool error= open_tables(thd, &table_list, &tables_opened, 0,
|
bool error= open_tables(thd, &table_list, &tables_opened, 0,
|
||||||
&alter_prelocking_strategy);
|
&alter_prelocking_strategy);
|
||||||
thd->open_options&= ~HA_OPEN_FOR_ALTER;
|
thd->open_options&= ~HA_OPEN_FOR_ALTER;
|
||||||
bool versioned= table_list->table && table_list->table->versioned();
|
|
||||||
|
TABLE *table= table_list->table;
|
||||||
|
bool versioned= table && table->versioned();
|
||||||
bool vers_survival_mod= false;
|
bool vers_survival_mod= false;
|
||||||
|
|
||||||
if (versioned)
|
if (versioned)
|
||||||
{
|
{
|
||||||
|
if (create_info->db_type &&
|
||||||
|
table->s->db_type() != create_info->db_type && (
|
||||||
|
table->file->native_versioned() ||
|
||||||
|
create_info->db_type->flags & HTON_NATIVE_SYS_VERSIONING))
|
||||||
|
{
|
||||||
|
my_error(ER_VERS_ALTER_ENGINE_PROHIBITED, MYF(0), table_list->db, table_list->table_name);
|
||||||
|
DBUG_RETURN(true);
|
||||||
|
}
|
||||||
bool vers_data_mod= alter_info->data_modifying();
|
bool vers_data_mod= alter_info->data_modifying();
|
||||||
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_SURVIVE)
|
if (thd->variables.vers_alter_history == VERS_ALTER_HISTORY_SURVIVE)
|
||||||
{
|
{
|
||||||
@ -8895,7 +8905,6 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name,
|
|||||||
if (error)
|
if (error)
|
||||||
DBUG_RETURN(true);
|
DBUG_RETURN(true);
|
||||||
|
|
||||||
TABLE *table= table_list->table;
|
|
||||||
table->use_all_columns();
|
table->use_all_columns();
|
||||||
MDL_ticket *mdl_ticket= table->mdl_ticket;
|
MDL_ticket *mdl_ticket= table->mdl_ticket;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user