Skip to content

Commit dfb6f96

Browse files
committed
MDEV-15190 Bad error for non-versioned table PARTITION BY SYSTEM_TIME
1 parent edeeaac commit dfb6f96

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

mysql-test/suite/versioning/r/partition.result

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ create or replace table t1 (x int)
4242
partition by system_time (
4343
partition p0 history,
4444
partition pn current);
45-
ERROR HY000: Transaction system versioning for `t1` is not supported
45+
ERROR HY000: Table `t1` is not system-versioned
4646
create or replace table t1 (x int);
4747
alter table t1
4848
partition by system_time (
4949
partition p0 history,
5050
partition pn current);
51-
Got one of the listed errors
51+
ERROR HY000: Table `t1` is not system-versioned
5252
create or replace table t1 (x int)
5353
with system versioning
5454
partition by system_time (

mysql-test/suite/versioning/t/partition.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ eval alter table t1 engine=$non_default_engine;
3333

3434
--echo ## CREATE TABLE
3535

36-
--error ER_VERS_ENGINE_UNSUPPORTED
36+
--error ER_VERS_NOT_VERSIONED
3737
create or replace table t1 (x int)
3838
partition by system_time (
3939
partition p0 history,
4040
partition pn current);
4141

4242
create or replace table t1 (x int);
43-
--error ER_VERS_ENGINE_UNSUPPORTED,ER_VERS_ENGINE_UNSUPPORTED
43+
--error ER_VERS_NOT_VERSIONED
4444
alter table t1
4545
partition by system_time (
4646
partition p0 history,

sql/partition_info.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ bool partition_info::vers_setup_expression(THD * thd, uint32 alter_add)
928928
{
929929
if (!table->versioned())
930930
{
931-
my_error(ER_VERS_ENGINE_UNSUPPORTED, MYF(0), table->s->table_name.str);
931+
// frm must be corrupted, normally CREATE/ALTER TABLE checks for that
932+
my_error(ER_FILE_CORRUPT, MYF(0), table->s->path.str);
932933
return true;
933934
}
934935

sql/sql_table.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4641,6 +4641,12 @@ handler *mysql_create_frm_image(THD *thd,
46414641
goto err;
46424642
part_info->default_engine_type= engine_type;
46434643

4644+
if (part_info->vers_info && !create_info->versioned())
4645+
{
4646+
my_error(ER_VERS_NOT_VERSIONED, MYF(0), table_name->str);
4647+
goto err;
4648+
}
4649+
46444650
/*
46454651
We reverse the partitioning parser and generate a standard format
46464652
for syntax stored in frm file.

0 commit comments

Comments
 (0)