Commit b13fe8e5 authored by Nayuta Yanagisawa's avatar Nayuta Yanagisawa Committed by Nikita Malyavin

MDEV-18842: Unfortunate error message when the same column is used for...

MDEV-18842: Unfortunate error message when the same column is used for application period start and end

An application-time period must be composed of two different columns.
We added a check that ensures that the above condition is met.
parent 0f04f613
......@@ -45,6 +45,10 @@ 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'
# MDEV-18842: Unfortunate error message when the same column is used
# for application period start and end
create or replace table t (s date, t date, period for apt(s,s));
ERROR 42000: Column 's' specified twice
create or replace table t (id int primary key, s date, e date,
period for mytime(s,e),
period for mytime2(s,e));
......
......@@ -31,6 +31,12 @@ create or replace table t (id int primary key, s time, e time,
--error ER_BAD_FIELD_ERROR
create or replace table t (id int primary key, s date, e date,
period for mytime(s,x));
--echo # MDEV-18842: Unfortunate error message when the same column is used
--echo # for application period start and end
--error ER_FIELD_SPECIFIED_TWICE
create or replace table t (s date, t date, period for apt(s,s));
--error ER_MORE_THAN_ONE_PERIOD
create or replace table t (id int primary key, s date, e date,
period for mytime(s,e),
......
......@@ -4361,6 +4361,12 @@ struct LEX: public Query_tables_list
int add_period(Lex_ident name, Lex_ident_sys_st start, Lex_ident_sys_st end)
{
if (lex_string_cmp(system_charset_info, &start, &end) == 0)
{
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), start.str);
return 1;
}
Table_period_info &info= create_info.period_info;
if (check_exists && info.name.streq(name))
......
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