summaryrefslogtreecommitdiff
path: root/sql/sql_trigger.cc
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-11-23 23:39:59 +0200
committerMichael Widenius <monty@askmonty.org>2010-11-23 23:39:59 +0200
commitb52020221e8b4e58d1bc6dd5a5a6f065a6a3a083 (patch)
tree6068b9d90b4127b1c3608e29913fa82bf1a1f20e /sql/sql_trigger.cc
parent7840965db9460e2117c163f3db83aaa247c65203 (diff)
parent498ee6bd19eabc85dcbd9abebc9cf6aeb79d1985 (diff)
downloadmariadb-git-b52020221e8b4e58d1bc6dd5a5a6f065a6a3a083.tar.gz
Merge with MySQL 5.1.52
Diffstat (limited to 'sql/sql_trigger.cc')
-rw-r--r--sql/sql_trigger.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index f6864add19f..e32bedd80a0 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -1986,6 +1986,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
bool err_status;
Sub_statement_state statement_state;
sp_head *sp_trigger= bodies[event][time_type];
+ SELECT_LEX *save_current_select;
if (sp_trigger == NULL)
return FALSE;
@@ -2009,11 +2010,19 @@ bool Table_triggers_list::process_triggers(THD *thd,
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
+ /*
+ Reset current_select before call execute_trigger() and
+ restore it after return from one. This way error is set
+ in case of failure during trigger execution.
+ */
+ save_current_select= thd->lex->current_select;
+ thd->lex->current_select= NULL;
err_status=
sp_trigger->execute_trigger(thd,
&trigger_table->s->db,
&trigger_table->s->table_name,
&subject_table_grants[event][time_type]);
+ thd->lex->current_select= save_current_select;
thd->restore_sub_statement_state(&statement_state);