summaryrefslogtreecommitdiff
path: root/sql/sql_update.cc
diff options
context:
space:
mode:
authorJorgen Loland <jorgen.loland@oracle.com>2010-11-15 16:18:04 +0100
committerJorgen Loland <jorgen.loland@oracle.com>2010-11-15 16:18:04 +0100
commit1945734c2de6853a2921e3560fe7c956ca286e0e (patch)
tree7f5fd88d64ca0dfb00050c67d5ba64c567d6db1d /sql/sql_update.cc
parent9893c5a248c6fcbe33b4bed76979409eda2ebf52 (diff)
downloadmariadb-git-1945734c2de6853a2921e3560fe7c956ca286e0e.tar.gz
Bug#54812: assert in Diagnostics_area::set_ok_status
during EXPLAIN Before the patch, send_eof() of some subclasses of select_result (e.g., select_send::send_eof()) could handle being called after an error had occured while others could not. The methods that were not well-behaved would trigger an ASSERT on debug builds. Release builds were not affected. Consider the following query as an example for how the ASSERT could be triggered: A user without execute privilege on f() does SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1; resulting in "ERROR 42000: execute command denied to user..." The server would end the query by calling send_eof(). The fact that the error had occured would make the ASSERT trigger. select_dumpvar::send_eof() was the offending method in the bug report, but the problem also applied to other subclasses of select_result. This patch uniforms send_eof() of all subclasses of select_result to handle being called after an error has occured. mysql-test/r/not_embedded_server.result: Added test for BUG#54812 mysql-test/t/not_embedded_server.test: Added test for BUG#54812 sql/sql_class.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. sql/sql_insert.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. Also fix call to abort() in select_create::send_eof(), which was supposed to abort the result set, not terminate the server. This call to abort() should have been changed when the function was renamed from abort_result_set() but was forgotten. New test case added by BUG#54812 covered this line and terminated server. sql/sql_prepare.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured. sql/sql_update.cc: send_eof() of all subclasses of select_result can now handle being called after an error has occured.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r--sql/sql_update.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index 96b1ac67b49..8cc8d511fd6 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -2064,7 +2064,9 @@ bool multi_update::send_eof()
Does updates for the last n - 1 tables, returns 0 if ok;
error takes into account killed status gained in do_updates()
*/
- int local_error = (table_count) ? do_updates() : 0;
+ int local_error= thd->is_error();
+ if (!local_error)
+ local_error = (table_count) ? do_updates() : 0;
/*
if local_error is not set ON until after do_updates() then
later carried out killing should not affect binlogging.