Skip to content

Commit

Permalink
MDEV-15168 Unexpected ER_VERS_ENGINE_UNSUPPORTED upon dropping versio…
Browse files Browse the repository at this point in the history
…ning on a partitioned table

Vers_parse_info::fix_alter_info(): disallow DROP SYSTEM VERSIONING
for system_time partitioned tables.
  • Loading branch information
kevgs authored and vuvova committed Feb 23, 2018
1 parent f685604 commit 68c9944
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
7 changes: 7 additions & 0 deletions mysql-test/suite/versioning/r/partition.result
Expand Up @@ -542,6 +542,13 @@ partition by system_time limit 100 (partition p1 history, partition pn current);
insert into t1 values (1,10), (2,20);
create or replace view v1 as select * from t1;
update v1 set f= 30;
#
# MDEV-15168 Unexpected ER_VERS_ENGINE_UNSUPPORTED upon dropping versioning on a partitioned table
#
create or replace table t (a int) with system versioning
partition by system_time (partition p1 history, partition pn current);
alter table t drop system versioning;
ERROR HY000: Can not DROP SYSTEM VERSIONING for table `t` partitioned BY SYSTEM_TIME
# Test cleanup
drop database test;
create database test;
8 changes: 8 additions & 0 deletions mysql-test/suite/versioning/t/partition.test
Expand Up @@ -454,6 +454,14 @@ insert into t1 values (1,10), (2,20);
create or replace view v1 as select * from t1;
update v1 set f= 30;

--echo #
--echo # MDEV-15168 Unexpected ER_VERS_ENGINE_UNSUPPORTED upon dropping versioning on a partitioned table
--echo #
create or replace table t (a int) with system versioning
partition by system_time (partition p1 history, partition pn current);
--error ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION
alter table t drop system versioning;

--echo # Test cleanup
drop database test;
create database test;
8 changes: 8 additions & 0 deletions sql/handler.cc
Expand Up @@ -7167,6 +7167,14 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name);
return true;
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
if (table->part_info &&
table->part_info->part_type == VERSIONING_PARTITION)
{
my_error(ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION, MYF(0), table_name);
return true;
}
#endif

return false;
}
Expand Down
4 changes: 2 additions & 2 deletions sql/share/errmsg-utf8.txt
Expand Up @@ -7882,8 +7882,8 @@ ER_VERS_NO_TRX_ID
ER_VERS_ALTER_SYSTEM_FIELD
eng "Can not change system versioning field %`s"

ER_UNUSED_24
eng "You should never see it"
ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION
eng "Can not DROP SYSTEM VERSIONING for table %`s partitioned BY SYSTEM_TIME"

ER_NOT_LOG_TABLE
eng "Table %`s.%`s is not a log table"
Expand Down

0 comments on commit 68c9944

Please sign in to comment.