summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.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
commit4bfd2121776d0ce7ebd6761b807f083da87cb185 (patch)
tree7f5fd88d64ca0dfb00050c67d5ba64c567d6db1d /sql/sql_prepare.cc
parent616f90b37250d4618fa0c71b881c754f72c00069 (diff)
downloadmariadb-git-4bfd2121776d0ce7ebd6761b807f083da87cb185.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.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 6a84d050d7f..851782c623f 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -2898,8 +2898,15 @@ bool Select_fetch_protocol_binary::send_result_set_metadata(List<Item> &list, ui
bool Select_fetch_protocol_binary::send_eof()
{
+ /*
+ Don't send EOF if we're in error condition (which implies we've already
+ sent or are sending an error)
+ */
+ if (thd->is_error())
+ return true;
+
::my_eof(thd);
- return FALSE;
+ return false;
}