Skip to content

Commit

Permalink
MDEV-15190 Bad error for non-versioned table PARTITION BY SYSTEM_TIME
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Feb 23, 2018
1 parent edeeaac commit dfb6f96
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions mysql-test/suite/versioning/r/partition.result
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ create or replace table t1 (x int)
partition by system_time (
partition p0 history,
partition pn current);
ERROR HY000: Transaction system versioning for `t1` is not supported
ERROR HY000: Table `t1` is not system-versioned
create or replace table t1 (x int);
alter table t1
partition by system_time (
partition p0 history,
partition pn current);
Got one of the listed errors
ERROR HY000: Table `t1` is not system-versioned
create or replace table t1 (x int)
with system versioning
partition by system_time (
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/suite/versioning/t/partition.test
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ eval alter table t1 engine=$non_default_engine;

--echo ## CREATE TABLE

--error ER_VERS_ENGINE_UNSUPPORTED
--error ER_VERS_NOT_VERSIONED
create or replace table t1 (x int)
partition by system_time (
partition p0 history,
partition pn current);

create or replace table t1 (x int);
--error ER_VERS_ENGINE_UNSUPPORTED,ER_VERS_ENGINE_UNSUPPORTED
--error ER_VERS_NOT_VERSIONED
alter table t1
partition by system_time (
partition p0 history,
Expand Down
3 changes: 2 additions & 1 deletion sql/partition_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,8 @@ bool partition_info::vers_setup_expression(THD * thd, uint32 alter_add)
{
if (!table->versioned())
{
my_error(ER_VERS_ENGINE_UNSUPPORTED, MYF(0), table->s->table_name.str);
// frm must be corrupted, normally CREATE/ALTER TABLE checks for that
my_error(ER_FILE_CORRUPT, MYF(0), table->s->path.str);
return true;
}

Expand Down
6 changes: 6 additions & 0 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4641,6 +4641,12 @@ handler *mysql_create_frm_image(THD *thd,
goto err;
part_info->default_engine_type= engine_type;

if (part_info->vers_info && !create_info->versioned())
{
my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name->str);
goto err;
}

/*
We reverse the partitioning parser and generate a standard format
for syntax stored in frm file.
Expand Down

0 comments on commit dfb6f96

Please sign in to comment.