Commit 58cd2a8d authored by Aleksey Midenkov's avatar Aleksey Midenkov

MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()

Throw ER_NOT_FORM_FILE if this is wrong FRM data (warning with
ER_VERS_FIELD_WRONG_TYPE is still printed for deeper knowledge of what
was happened).

Keep ER_VERS_FIELD_WRONG_TYPE for creating partitioned table with
trx-versioning. Tested by MDEV-15951 in trx_id.test
parent 020e7d89
...@@ -50,5 +50,17 @@ t4 CREATE TABLE `t4` ( ...@@ -50,5 +50,17 @@ t4 CREATE TABLE `t4` (
`row_end` timestamp(6) GENERATED ALWAYS AS ROW END, `row_end` timestamp(6) GENERATED ALWAYS AS ROW END,
PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`) PERIOD FOR SYSTEM_TIME (`row_start`, `row_end`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
set global debug_dbug=@old_dbug;
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
#
# MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()
#
create table t1 (x int) with system versioning;
set debug_dbug='+d,error_vers_wrong_type';
show create table t1;
ERROR HY000: Incorrect information in file: './test/t1.frm'
show warnings;
Level Code Message
Warning 4110 `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
Error 1033 Incorrect information in file: './test/t1.frm'
drop table t1;
set global debug_dbug=@old_dbug;
...@@ -30,6 +30,17 @@ set debug_dbug='+d,sysvers_show'; ...@@ -30,6 +30,17 @@ set debug_dbug='+d,sysvers_show';
show create table t3; show create table t3;
create table t4 (a int); create table t4 (a int);
show create table t4; show create table t4;
drop table t1, t2, t3, t4;
--echo #
--echo # MDEV-19525 remove ER_VERS_FIELD_WRONG_TYPE from init_from_binary_frm_image()
--echo #
create table t1 (x int) with system versioning;
set debug_dbug='+d,error_vers_wrong_type';
--replace_result $MYSQLTEST_VARDIR . master-data// '' '\\' '/'
--error ER_NOT_FORM_FILE
show create table t1;
show warnings;
drop table t1;
set global debug_dbug=@old_dbug; set global debug_dbug=@old_dbug;
drop table t1, t2, t3, t4;
...@@ -2082,6 +2082,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -2082,6 +2082,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
if (flags & VERS_SYSTEM_FIELD) if (flags & VERS_SYSTEM_FIELD)
{ {
if (DBUG_EVALUATE_IF("error_vers_wrong_type", 1, 0))
field_type= MYSQL_TYPE_BLOB;
switch (field_type) switch (field_type)
{ {
case MYSQL_TYPE_TIMESTAMP2: case MYSQL_TYPE_TIMESTAMP2:
...@@ -2094,8 +2097,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, ...@@ -2094,8 +2097,12 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
} }
/* Fallthrough */ /* Fallthrough */
default: default:
my_error(ER_VERS_FIELD_WRONG_TYPE, MYF(0), fieldnames.type_names[i], my_error(ER_VERS_FIELD_WRONG_TYPE,
versioned == VERS_TIMESTAMP ? "TIMESTAMP(6)" : "BIGINT(20) UNSIGNED", (field_type == MYSQL_TYPE_LONGLONG ?
MYF(0) : MYF(ME_WARNING)),
fieldnames.type_names[i],
(versioned == VERS_TIMESTAMP ?
"TIMESTAMP(6)" : "BIGINT(20) UNSIGNED"),
table_name.str); table_name.str);
goto err; goto err;
} }
......
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