Commit c847089e authored by Sergei Golubchik's avatar Sergei Golubchik

Cannot DROP VERSIONING without dropping all visible AS ROW fields

parent f3a49e70
......@@ -64,6 +64,8 @@ t CREATE TABLE `t` (
`trx_end` timestamp(6) GENERATED ALWAYS AS ROW END INVISIBLE,
PERIOD FOR SYSTEM_TIME (`trx_start`, `trx_end`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t drop system versioning;
ERROR HY000: System versioning field `trx_start` exists
alter table t drop column trx_start, drop column trx_end;
alter table t drop system versioning;
show create table t;
......
......@@ -53,6 +53,9 @@ alter table t
add system versioning;
show create table t;
--error ER_VERS_SYS_FIELD_EXISTS
alter table t drop system versioning;
alter table t drop column trx_start, drop column trx_end;
alter table t drop system versioning;
show create table t;
......
......@@ -8009,6 +8009,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
def_it.remove();
}
}
else if (alter_info->flags & Alter_info::ALTER_DROP_SYSTEM_VERSIONING &&
field->flags & VERS_SYSTEM_FIELD &&
field->invisible < INVISIBLE_SYSTEM)
{
my_error(ER_VERS_SYS_FIELD_EXISTS, MYF(0), field->field_name.str);
goto err;
}
else
{
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment