List:Commits« Previous MessageNext Message »
From:marc.alff Date:August 22 2006 4:06pm
Subject:bk commit into 5.0 tree (malff:1.2240)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marcsql. When marcsql does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-08-22 09:06:00-07:00, malff@weblab.(none) +3 -0
  Merge malff@stripped:/home/bk/mysql-5.0-runtime
  into  weblab.(none):/home/marcsql/TREE/mysql-5.0-8153
  MERGE: 1.2196.22.28

  mysql-test/r/sp.result@stripped, 2006-08-22 09:05:57-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.202.1.3

  mysql-test/t/sp.test@stripped, 2006-08-22 09:05:57-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.192.1.1

  sql/mysqld.cc@stripped, 2006-08-22 09:05:57-07:00, malff@weblab.(none) +0 -0
    Auto merged
    MERGE: 1.560.1.1

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	malff
# Host:	weblab.(none)
# Root:	/home/marcsql/TREE/mysql-5.0-8153/RESYNC

--- 1.563/sql/mysqld.cc	2006-08-22 09:06:04 -07:00
+++ 1.564/sql/mysqld.cc	2006-08-22 09:06:04 -07:00
@@ -2392,10 +2392,8 @@ static int my_message_sql(uint error, co
   if ((thd= current_thd))
   {
     if (thd->spcont &&
-        thd->spcont->find_handler(error, MYSQL_ERROR::WARN_LEVEL_ERROR))
+        thd->spcont->handle_error(error, MYSQL_ERROR::WARN_LEVEL_ERROR, thd))
     {
-      if (! thd->spcont->found_handler_here())
-        thd->net.report_error= 1; /* Make "select" abort correctly */
       DBUG_RETURN(0);
     }
 

--- 1.206/mysql-test/r/sp.result	2006-08-22 09:06:04 -07:00
+++ 1.207/mysql-test/r/sp.result	2006-08-22 09:06:04 -07:00
@@ -4872,8 +4872,6 @@ declare continue handler for sqlexceptio
 select no_such_function();
 end|
 call bug18787()|
-no_such_function()
-NULL
 drop procedure bug18787|
 create database bug18344_012345678901|
 use bug18344_012345678901|
@@ -5220,6 +5218,66 @@ CHARSET(p2)	COLLATION(p2)
 cp1251	cp1251_general_ci
 CHARSET(p3)	COLLATION(p3)
 greek	greek_general_ci
+drop table if exists t3, t4, t5|
+drop procedure if exists bug8153_subselect|
+drop procedure if exists bug8153_function|
+create table t3 (a int)|
+create table t4 (a int)|
+insert into t3 values (1)|
+insert into t4 values (1), (1)|
+create procedure bug8153_subselect()
+begin
+declare continue handler for sqlexception
+begin
+select 'statement failed';
+end;
+update t3 set a=a+1 where (select a from t4 where a=1) is null;
+select 'statement after update';
+end|
+call bug8153_subselect()|
+statement failed
+statement failed
+statement after update
+statement after update
+select * from t3|
+a
+1
+call bug8153_subselect()|
+statement failed
+statement failed
+statement after update
+statement after update
+select * from t3|
+a
+1
+drop procedure bug8153_subselect|
+create procedure bug8153_function_a()
+begin
+declare continue handler for sqlexception
+begin
+select 'in continue handler';
+end;
+select 'reachable code a1';
+call bug8153_function_b();
+select 'reachable code a2';
+end|
+create procedure bug8153_function_b()
+begin
+select 'reachable code b1';
+select no_such_function();
+select 'unreachable code b2';
+end|
+call bug8153_function_a()|
+reachable code a1
+reachable code a1
+reachable code b1
+reachable code b1
+in continue handler
+in continue handler
+reachable code a2
+reachable code a2
+drop procedure bug8153_function_a|
+drop procedure bug8153_function_b|
 use test|
 DROP DATABASE mysqltest1|
 drop procedure if exists bug19862|

--- 1.194/mysql-test/t/sp.test	2006-08-22 09:06:04 -07:00
+++ 1.195/mysql-test/t/sp.test	2006-08-22 09:06:04 -07:00
@@ -6141,6 +6141,68 @@ SET @v3 = 'c'|
 CALL bug16676_p1('a', @v2, @v3)|
 CALL bug16676_p2('a', @v2, @v3)|
 
+#
+# BUG#8153: Stored procedure with subquery and continue handler, wrong result
+#
+
+--disable_warnings
+drop table if exists t3, t4, t5|
+drop procedure if exists bug8153_subselect|
+drop procedure if exists bug8153_function|
+--enable_warnings
+
+create table t3 (a int)|
+create table t4 (a int)|
+insert into t3 values (1)|
+insert into t4 values (1), (1)|
+
+## Testing the use case reported in Bug#8153
+
+create procedure bug8153_subselect()
+begin
+  declare continue handler for sqlexception
+  begin
+    select 'statement failed';
+  end;
+  update t3 set a=a+1 where (select a from t4 where a=1) is null;
+  select 'statement after update';
+end|
+
+call bug8153_subselect()|
+select * from t3|
+
+call bug8153_subselect()|
+select * from t3|
+
+drop procedure bug8153_subselect|
+
+## Testing extra use cases, found while investigating
+## This is related to BUG#18787, with a non local handler
+
+create procedure bug8153_function_a()
+begin
+  declare continue handler for sqlexception
+  begin
+    select 'in continue handler';
+  end;
+
+  select 'reachable code a1';
+  call bug8153_function_b();
+  select 'reachable code a2';
+end|
+
+create procedure bug8153_function_b()
+begin
+  select 'reachable code b1';
+  select no_such_function();
+  select 'unreachable code b2';
+end|
+
+call bug8153_function_a()|
+
+drop procedure bug8153_function_a|
+drop procedure bug8153_function_b|
+
 # Cleanup.
 
 use test|
Thread
bk commit into 5.0 tree (malff:1.2240)marc.alff23 Aug