Commit 8ad23ff4 authored by Sergei Golubchik's avatar Sergei Golubchik

don't allow TIME columns in PERIOD specification

parent 7b48724d
......@@ -40,6 +40,9 @@ ERROR HY000: Fields of PERIOD FOR `mytime` have different types
create or replace table t (id int primary key, s int, e date,
period for mytime(s,e));
ERROR 42000: Incorrect column specifier for column 's'
create or replace table t (id int primary key, s time, e time,
period for mytime(s,e));
ERROR 42000: Incorrect column specifier for column 's'
create or replace table t (id int primary key, s date, e date,
period for mytime(s,x));
ERROR 42S22: Unknown column 'x' in 'mytime'
......
......@@ -26,6 +26,9 @@ create or replace table t (s timestamp(2), e timestamp(6),
--error ER_WRONG_FIELD_SPEC
create or replace table t (id int primary key, s int, e date,
period for mytime(s,e));
--error ER_WRONG_FIELD_SPEC
create or replace table t (id int primary key, s time, e time,
period for mytime(s,e));
--error ER_BAD_FIELD_ERROR
create or replace table t (id int primary key, s date, e date,
period for mytime(s,x));
......
......@@ -7593,7 +7593,8 @@ bool Table_period_info::check_field(const Create_field* f,
my_error(ER_BAD_FIELD_ERROR, MYF(0), f_name.str, name.str);
res= true;
}
else if (f->type_handler()->mysql_timestamp_type() == MYSQL_TIMESTAMP_ERROR)
else if (f->type_handler()->mysql_timestamp_type() != MYSQL_TIMESTAMP_DATE &&
f->type_handler()->mysql_timestamp_type() != MYSQL_TIMESTAMP_DATETIME)
{
my_error(ER_WRONG_FIELD_SPEC, MYF(0), f->field_name.str);
res= true;
......
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