diff options
Diffstat (limited to 'sql/sql_alter.cc')
-rw-r--r-- | sql/sql_alter.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 0230ee1df12..bc4c903d05d 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -239,7 +239,8 @@ bool Alter_info::vers_prohibited(THD *thd) const Alter_table_ctx::Alter_table_ctx() - : datetime_field(NULL), error_if_not_empty(false), + : implicit_default_value_error_field(NULL), + error_if_not_empty(false), tables_opened(0), db(null_clex_str), table_name(null_clex_str), alias(null_clex_str), new_db(null_clex_str), new_name(null_clex_str), new_alias(null_clex_str), @@ -260,7 +261,7 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list, uint tables_opened_arg, const LEX_CSTRING *new_db_arg, const LEX_CSTRING *new_name_arg) - : datetime_field(NULL), error_if_not_empty(false), + : implicit_default_value_error_field(NULL), error_if_not_empty(false), tables_opened(tables_opened_arg), new_db(*new_db_arg), new_name(*new_name_arg), fk_error_if_delete_row(false), fk_error_id(NULL), @@ -352,6 +353,19 @@ Alter_table_ctx::Alter_table_ctx(THD *thd, TABLE_LIST *table_list, } +void Alter_table_ctx::report_implicit_default_value_error(THD *thd, + const TABLE_SHARE *s) + const +{ + Create_field *error_field= implicit_default_value_error_field; + const Type_handler *h= error_field->type_handler(); + thd->push_warning_truncated_value_for_field(Sql_condition::WARN_LEVEL_WARN, + h->name().ptr(), + h->default_value().ptr(), + s, error_field->field_name.str); +} + + bool Sql_cmd_alter_table::execute(THD *thd) { LEX *lex= thd->lex; @@ -380,6 +394,7 @@ bool Sql_cmd_alter_table::execute(THD *thd) */ HA_CREATE_INFO create_info(lex->create_info); Alter_info alter_info(lex->alter_info, thd->mem_root); + create_info.alter_info= &alter_info; ulong priv=0; ulong priv_needed= ALTER_ACL; bool result; |