diff --git a/sql/handler.cc b/sql/handler.cc index 0e507159fdc1..7d608f3005de 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7511,7 +7511,7 @@ static bool check_table_binlog_row_based(THD *thd, TABLE *table) table->s->cached_row_logging_check && (thd->variables.option_bits & OPTION_BIN_LOG) && mysql_bin_log.is_open() && - !table->pos_in_table_list->disable_sql_log_bin_triggers); + !table->disable_sql_log_bin_triggers); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index fbf582cb2e39..170c2d782bc1 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8540,6 +8540,8 @@ bool setup_tables(THD *thd, Name_resolution_context *context, { TABLE *table= table_list->table; table->pos_in_table_list= table_list; + table->disable_sql_log_bin_triggers= + table_list->disable_sql_log_bin_triggers; if (first_select_table && table_list->top_table() == first_select_table) { diff --git a/sql/sql_optimizer.cc b/sql/sql_optimizer.cc index e0fb21e631f7..a32113714198 100644 --- a/sql/sql_optimizer.cc +++ b/sql/sql_optimizer.cc @@ -3212,6 +3212,7 @@ make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, Item *conds, TABLE *const table= tables->table; s->table= table; table->pos_in_table_list= tables; + table->disable_sql_log_bin_triggers= tables->disable_sql_log_bin_triggers; error= tables->fetch_number_of_rows(); DBUG_EXECUTE_IF("bug11747970_raise_error", diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 0fa2b5510831..4ff35c51a57a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -2748,6 +2748,7 @@ bool JOIN::setup_materialized_table(JOIN_TAB *tab, uint tableno, tab->materialize_table= join_materialize_semijoin; table->pos_in_table_list= tl; + table->disable_sql_log_bin_triggers= tl->disable_sql_log_bin_triggers; table->keys_in_use_for_query.set_all(); sjm_pos->table= tab; sjm_pos->sj_strategy= SJ_OPT_NONE; diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 5bf2708e3422..fc329429c41a 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1639,6 +1639,7 @@ int multi_update::prepare(List ¬_used_values, table->no_keyread=1; table->covering_keys.clear_all(); table->pos_in_table_list= tl; + table->disable_sql_log_bin_triggers= tl->disable_sql_log_bin_triggers; table->prepare_triggers_for_update_stmt_or_event(); } } diff --git a/sql/table.cc b/sql/table.cc index c6ef2cbaf1a1..bdead57007f2 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -4035,6 +4035,7 @@ void TABLE::init(THD *thd, TABLE_LIST *tl) auto_increment_field_not_null= FALSE; pos_in_table_list= tl; + disable_sql_log_bin_triggers= tl->disable_sql_log_bin_triggers; clear_column_bitmaps(); diff --git a/sql/table.h b/sql/table.h index 29697e2dd318..28d571f5d79f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1292,6 +1292,7 @@ struct TABLE close_thread_tables!!! */ my_bool m_needs_reopen; + my_bool disable_sql_log_bin_triggers; private: bool created; /* For tmp tables. TRUE <=> tmp table has been instantiated.*/ bool tmp_file_created; /* For tmp tables. It is TRUE when the files of the