mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-16975 Application-time periods: ALTER TABLE
* implicit period constraint is hidden and cannot be dropped independently * create...like and create...select support
This commit is contained in:
committed by
Sergei Golubchik
parent
b2bd52290a
commit
6294516a56
@@ -7584,18 +7584,18 @@ bool Vers_parse_info::check_sys_fields(const Lex_table_name &table_name,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool check_period_field(const Create_field* f, const char* name,
|
||||
const char* period_name)
|
||||
bool Table_period_info::check_field(const Create_field* f,
|
||||
const Lex_ident& f_name) const
|
||||
{
|
||||
bool res= false;
|
||||
if (!f)
|
||||
{
|
||||
my_error(ER_BAD_FIELD_ERROR, MYF(0), name, period_name);
|
||||
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)
|
||||
{
|
||||
my_error(ER_WRONG_FIELD_SPEC, MYF(0), name);
|
||||
my_error(ER_WRONG_FIELD_SPEC, MYF(0), f->field_name.str);
|
||||
res= true;
|
||||
}
|
||||
else if (f->vcol_info || f->flags & VERS_SYSTEM_FIELD)
|
||||
@@ -7610,10 +7610,13 @@ static bool check_period_field(const Create_field* f, const char* name,
|
||||
bool Table_scope_and_contents_source_st::check_fields(
|
||||
THD *thd, Alter_info *alter_info, TABLE_LIST &create_table)
|
||||
{
|
||||
bool res= vers_check_system_fields(thd, alter_info, create_table);
|
||||
if (res)
|
||||
return true;
|
||||
return vers_check_system_fields(thd, alter_info, create_table)
|
||||
|| check_period_fields(thd, alter_info);
|
||||
}
|
||||
|
||||
bool Table_scope_and_contents_source_st::check_period_fields(
|
||||
THD *thd, Alter_info *alter_info)
|
||||
{
|
||||
if (!period_info.name)
|
||||
return false;
|
||||
|
||||
@@ -7639,8 +7642,8 @@ bool Table_scope_and_contents_source_st::check_fields(
|
||||
}
|
||||
}
|
||||
|
||||
res= check_period_field(row_start, period.start.str, period_info.name.str);
|
||||
res= res || check_period_field(row_end, period.end.str, period_info.name.str);
|
||||
bool res= period_info.check_field(row_start, period.start.str)
|
||||
|| period_info.check_field(row_end, period.end.str);
|
||||
if (res)
|
||||
return true;
|
||||
|
||||
@@ -7660,9 +7663,14 @@ Table_scope_and_contents_source_st::fix_create_fields(THD *thd,
|
||||
const TABLE_LIST &create_table,
|
||||
bool create_select)
|
||||
{
|
||||
if (vers_fix_system_fields(thd, alter_info, create_table, create_select))
|
||||
return true;
|
||||
return vers_fix_system_fields(thd, alter_info, create_table, create_select)
|
||||
|| fix_period_fields(thd, alter_info);
|
||||
}
|
||||
|
||||
bool
|
||||
Table_scope_and_contents_source_st::fix_period_fields(THD *thd,
|
||||
Alter_info *alter_info)
|
||||
{
|
||||
if (!period_info.name)
|
||||
return false;
|
||||
|
||||
|
Reference in New Issue
Block a user