Commit 6473641b authored by Eugene Kosov's avatar Eugene Kosov Committed by Alexander Barkov

MDEV-18512 using DATETIME(6) as row_start/row_end crashes server

Disallow DATETIME for SYSTEM VERSIONING tables.
parent b7746050
......@@ -508,5 +508,12 @@ row_end bigint as row end,
period for system_time (row_start, row_end)
) engine=myisam with system versioning;
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
create table t (
a int,
row_start datetime(6) generated always as row start,
row_end datetime(6) generated always as row end,
period for system_time(row_start, row_end)
) with system versioning;
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t`
drop database test;
create database test;
......@@ -387,5 +387,14 @@ create or replace table t1 (
period for system_time (row_start, row_end)
) engine=myisam with system versioning;
--error ER_VERS_FIELD_WRONG_TYPE
create table t (
a int,
row_start datetime(6) generated always as row start,
row_end datetime(6) generated always as row end,
period for system_time(row_start, row_end)
) with system versioning;
drop database test;
create database test;
......@@ -7433,8 +7433,7 @@ bool Vers_parse_info::check_conditions(const Lex_table_name &table_name,
static bool is_versioning_timestamp(const Create_field *f)
{
return (f->type_handler() == &type_handler_datetime2 ||
f->type_handler() == &type_handler_timestamp2) &&
return f->type_handler() == &type_handler_timestamp2 &&
f->length == MAX_DATETIME_FULL_WIDTH;
}
......
......@@ -2025,7 +2025,6 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
switch (field_type)
{
case MYSQL_TYPE_TIMESTAMP2:
case MYSQL_TYPE_DATETIME2:
break;
case MYSQL_TYPE_LONGLONG:
if (vers_can_native)
......
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