summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-02-21 18:14:04 +0100
committerSergei Golubchik <serg@mariadb.org>2018-02-24 00:50:56 +0100
commitdfb6f96eaf6a94cfa4f0f508136a190ac22fd381 (patch)
tree114167ae4fa0a4e4b7308a3c18e1bd38d4d9957c
parentedeeaac45180373ac268cc8d0feb220b82d0519f (diff)
downloadmariadb-git-dfb6f96eaf6a94cfa4f0f508136a190ac22fd381.tar.gz
MDEV-15190 Bad error for non-versioned table PARTITION BY SYSTEM_TIME
-rw-r--r--mysql-test/suite/versioning/r/partition.result4
-rw-r--r--mysql-test/suite/versioning/t/partition.test4
-rw-r--r--sql/partition_info.cc3
-rw-r--r--sql/sql_table.cc6
4 files changed, 12 insertions, 5 deletions
diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index 5c305a9005e..c476e948574 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -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 (
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index 67f95aa9c49..4ae4013a2ea 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -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,
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index e6ad7c9b008..87d322cf7fa 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -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;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index e20208012d5..2bdd932706b 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -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.