From de2186dd2f5937a56d799f55c33078a7ad8ebddc Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 17 Oct 2019 14:08:33 +0200 Subject: MDEV-20074: Lost connection on update trigger Instead of checking lex->sql_command which does not corect in case of triggers mark tables for insert. --- sql/sp_head.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sql/sp_head.cc') diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 458955b2d6b..48166fac4c6 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -4652,6 +4652,7 @@ typedef struct st_sp_table uint lock_count; uint query_lock_count; uint8 trg_event_map; + my_bool for_insert_data; } SP_TABLE; @@ -4747,6 +4748,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) if (tab->query_lock_count > tab->lock_count) tab->lock_count++; tab->trg_event_map|= table->trg_event_map; + tab->for_insert_data|= table->for_insert_data; } else { @@ -4770,6 +4772,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check) tab->lock_type= table->lock_type; tab->lock_count= tab->query_lock_count= 1; tab->trg_event_map= table->trg_event_map; + tab->for_insert_data= table->for_insert_data; if (my_hash_insert(&m_sptabs, (uchar *)tab)) return FALSE; } @@ -4853,7 +4856,8 @@ sp_head::add_used_tables_to_table_list(THD *thd, TABLE_LIST::PRELOCK_ROUTINE, belong_to_view, stab->trg_event_map, - query_tables_last_ptr); + query_tables_last_ptr, + stab->for_insert_data); tab_buff+= ALIGN_SIZE(sizeof(TABLE_LIST)); result= TRUE; } -- cgit v1.2.1