From 80dd3a593a2d10281e77c242b827abb5b3a9dd92 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 13 Jul 2009 18:11:16 +0300 Subject: Bug #40113: Embedded SELECT inside UPDATE or DELETE can timeout without error When using quick access methods for searching rows in UPDATE or DELETE there was no check if a fatal error was not already sent to the client while evaluating the quick condition. As a result a false OK (following the error) was sent to the client and the error was thus transformed into a warning. Fixed by checking for errors sent to the client during SQL_SELECT::check_quick() and treating them as real errors. Fixed a wrong test case in group_min_max.test Fixed a wrong return code in mysql_update() and mysql_delete() --- sql/sql_update.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'sql/sql_update.cc') diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 481fe30c6e7..f95f0a22a71 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -230,7 +230,7 @@ int mysql_update(THD *thd, if (select_lex->inner_refs_list.elements && fix_inner_refs(thd, all_fields, select_lex, select_lex->ref_pointer_array)) - DBUG_RETURN(-1); + DBUG_RETURN(1); if (conds) { @@ -247,7 +247,14 @@ int mysql_update(THD *thd, { delete select; free_underlaid_joins(thd, select_lex); - if (error) + /* + There was an error or the error was already sent by + the quick select evaluation. + TODO: Add error code output parameter to Item::val_xxx() methods. + Currently they rely on the user checking DA for + errors when unwinding the stack after calling Item::val_xxx(). + */ + if (error || thd->net.report_error) { DBUG_RETURN(1); // Error in where } -- cgit v1.2.1