Commit df0771c6 authored by Sergei Golubchik's avatar Sergei Golubchik

no ALTER TABLE should return ER_NO_DEFAULT_FOR_FIELD

parent a5776aa3
...@@ -56,10 +56,6 @@ connection con2; ...@@ -56,10 +56,6 @@ connection con2;
insert into t1 values (123), (456), (789); insert into t1 values (123), (456), (789);
set debug_sync= 'now SIGNAL end'; set debug_sync= 'now SIGNAL end';
connection default; connection default;
Warnings:
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
Warning 1364 Field 'b' doesn't have a default value
select * from t1; select * from t1;
a b a b
5 0 5 0
......
...@@ -11534,6 +11534,22 @@ bool mysql_trans_commit_alter_copy_data(THD *thd) ...@@ -11534,6 +11534,22 @@ bool mysql_trans_commit_alter_copy_data(THD *thd)
} }
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
/*
locking ALTER TABLE doesn't issue ER_NO_DEFAULT_FOR_FIELD, so online
ALTER shouldn't either
*/
class Has_default_error_handler : public Internal_error_handler
{
public:
bool handle_condition(THD *, uint sql_errno, const char *,
Sql_condition::enum_warning_level *,
const char *, Sql_condition **)
{
return sql_errno == ER_NO_DEFAULT_FOR_FIELD;
}
};
static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi, static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
Cache_flip_event_log *log) Cache_flip_event_log *log)
{ {
...@@ -11550,6 +11566,8 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi, ...@@ -11550,6 +11566,8 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
thd_progress_report(thd, 0, my_b_write_tell(log_file)); thd_progress_report(thd, 0, my_b_write_tell(log_file));
Abort_on_warning_instant_set old_abort_on_warning(thd, 0); Abort_on_warning_instant_set old_abort_on_warning(thd, 0);
Has_default_error_handler hdeh;
thd->push_internal_handler(&hdeh);
do do
{ {
const auto *descr_event= rgi->rli->relay_log.description_event_for_exec; const auto *descr_event= rgi->rli->relay_log.description_event_for_exec;
...@@ -11569,6 +11587,7 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi, ...@@ -11569,6 +11587,7 @@ static int online_alter_read_from_binlog(THD *thd, rpl_group_info *rgi,
thd_progress_report(thd, my_b_tell(log_file), thd->progress.max_counter); thd_progress_report(thd, my_b_tell(log_file), thd->progress.max_counter);
DEBUG_SYNC(thd, "alter_table_online_progress"); DEBUG_SYNC(thd, "alter_table_online_progress");
} while(!error); } while(!error);
thd->pop_internal_handler();
return error; return error;
} }
......
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