MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Gleb Shchepa Date:November 26 2008 7:32pm
Subject:bzr commit into mysql-5.1 branch (gshchepa:2708) Bug#40745
View as plain text  
#At file:///work/bzr/5.1-40745/ based on revid:vvaintroub@stripped

 2708 Gleb Shchepa	2008-11-26
      Bug #40745: Error during WHERE clause calculation in UPDATE
                  leads to an assertion failure
      
      Any run-time error in stored function (like recursive function
      call or update of table that is already updating by statement
      which invoked this stored function etc.) that was used in some
      expression of the single-table UPDATE statement caused an
      assertion failure.
      Multiple-table UPDATE (as well as INSERT and both single- and
      multiple-table DELETE) are not affected.
modified:
  mysql-test/r/update.result
  mysql-test/t/update.test
  sql/sql_update.cc

per-file messages:
  mysql-test/r/update.result
    Added test case for bug #40745.
  mysql-test/t/update.test
    Added test case for bug #40745.
  sql/sql_update.cc
    Bug #40745: Error during WHERE clause calculation in UPDATE
                leads to an assertion failure
    
    The mysql_update function has been updated to take into account
    the status of invoked stored functions before setting the status
    of whole UPDATE query to OK.
=== modified file 'mysql-test/r/update.result'
--- a/mysql-test/r/update.result	2007-04-27 08:42:15 +0000
+++ b/mysql-test/r/update.result	2008-11-26 19:31:51 +0000
@@ -491,4 +491,13 @@ update t1 join t2 on (t1.a=t2.a) set t1.
 affected rows: 127
 info: Rows matched: 128  Changed: 127  Warnings: 0
 drop table t1,t2;
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+UPDATE t1 SET i = 3 WHERE f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+UPDATE t1 SET i = f1();
+ERROR HY000: Recursive stored functions and triggers are not allowed.
+DROP TABLE t1;
+DROP FUNCTION f1;
 End of 5.0 tests

=== modified file 'mysql-test/t/update.test'
--- a/mysql-test/t/update.test	2007-04-23 14:22:33 +0000
+++ b/mysql-test/t/update.test	2008-11-26 19:31:51 +0000
@@ -430,4 +430,21 @@ drop table t1,t2;
 connection default;
 disconnect con1;
 
+#
+# Bug #40745: Error during WHERE clause calculation in UPDATE
+#             leads to an assertion failure
+#
+
+CREATE FUNCTION f1() RETURNS INT RETURN f1();
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1);
+
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = 3 WHERE f1();
+--error ER_SP_NO_RECURSION
+UPDATE t1 SET i = f1();
+
+DROP TABLE t1;
+DROP FUNCTION f1;
+
 --echo End of 5.0 tests

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2008-10-09 15:57:41 +0000
+++ b/sql/sql_update.cc	2008-11-26 19:31:51 +0000
@@ -808,7 +808,7 @@ int mysql_update(THD *thd,
   id= thd->arg_of_last_insert_id_function ?
     thd->first_successful_insert_id_in_prev_stmt : 0;
 
-  if (error < 0)
+  if (error < 0 && !thd->is_error())
   {
     char buff[STRING_BUFFER_USUAL_SIZE];
     sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,

Thread
bzr commit into mysql-5.1 branch (gshchepa:2708) Bug#40745Gleb Shchepa26 Nov