List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:October 4 2011 9:13am
Subject:bzr push into mysql-trunk branch (jon.hauglid:3422 to 3423)
View as plain text  
 3423 Jon Olav Hauglid	2011-10-04 [merge]
      Merge from mysql-trunk-alik to mysql-trunk-stage.

    modified:
      mysql-test/r/sp-error.result
      mysql-test/t/sp-error.test
      sql/sp_rcontext.cc
 3422 Jon Olav Hauglid	2011-09-23 [merge]
      Merge from mysql-trunk to mysql-trunk-stage.
      No conflicts.

    removed:
      support-files/config.huge.ini.sh
      support-files/config.medium.ini.sh
      support-files/config.small.ini.sh
      support-files/ndb-config-2-node.ini.sh
    modified:
      client/mysqltest.cc
      extra/perror.c
      mysql-test/r/ctype_utf16.result
      mysql-test/r/func_str.result
      mysql-test/t/func_str.test
      plugin/auth/qa_auth_interface.c
      sql/item_create.cc
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/share/errmsg-utf8.txt
      sql/sql_base.cc
      storage/innobase/include/srv0mon.h
      storage/innobase/os/os0file.c
      storage/innobase/read/read0read.c
      storage/innobase/trx/trx0purge.c
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      strings/dtoa.c
      support-files/CMakeLists.txt
      tests/mysql_client_test.c
=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result	2011-09-20 12:25:40 +0000
+++ b/mysql-test/r/sp-error.result	2011-10-04 09:07:20 +0000
@@ -2775,3 +2775,19 @@ DROP PROCEDURE p5;
 DROP PROCEDURE p6;
 DROP TABLE t1;
 DROP TABLE t2;
+
+# Check DECLARE statements that raise conditions before handlers
+# are declared.
+
+DROP PROCEDURE IF EXISTS p1;
+CREATE PROCEDURE p1()
+BEGIN
+DECLARE var1 INTEGER DEFAULT 'string';
+DECLARE EXIT HANDLER FOR SQLWARNING BEGIN END;
+END|
+
+CALL p1();
+Warnings:
+Warning	1366	Incorrect integer value: 'string' for column 'var1' at row 1
+
+DROP PROCEDURE p1;

=== modified file 'mysql-test/t/sp-error.test'
--- a/mysql-test/t/sp-error.test	2011-09-20 12:13:07 +0000
+++ b/mysql-test/t/sp-error.test	2011-10-04 09:07:20 +0000
@@ -3716,3 +3716,28 @@ DROP PROCEDURE p5;
 DROP PROCEDURE p6;
 DROP TABLE t1;
 DROP TABLE t2;
+
+--echo
+--echo # Check DECLARE statements that raise conditions before handlers
+--echo # are declared.
+--echo
+
+--disable_warnings
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+delimiter |;
+
+CREATE PROCEDURE p1()
+BEGIN
+  DECLARE var1 INTEGER DEFAULT 'string';
+  DECLARE EXIT HANDLER FOR SQLWARNING BEGIN END;
+END|
+
+delimiter ;|
+
+--echo
+CALL p1();
+
+--echo
+DROP PROCEDURE p1;

=== modified file 'sql/sp_rcontext.cc'
--- a/sql/sp_rcontext.cc	2011-09-20 12:54:31 +0000
+++ b/sql/sp_rcontext.cc	2011-10-04 09:07:20 +0000
@@ -267,9 +267,6 @@ bool sp_rcontext::handle_sql_condition(T
 
   DBUG_ASSERT(found_condition);
 
-  // Mark active conditions so that they can be deleted when the handler exits.
-  da->mark_sql_conditions_for_removal();
-
   sp_handler_entry *handler_entry= NULL;
   for (int i= 0; i < m_handlers.elements(); ++i)
   {
@@ -282,7 +279,19 @@ bool sp_rcontext::handle_sql_condition(T
     }
   }
 
-  DBUG_ASSERT(handler_entry);
+  /*
+    handler_entry should not be NULL here, as that indicates
+    that the parser context thinks a HANDLER should be activated,
+    but the runtime context cannot find it.
+    However, this can currently happen if a statement that can
+    legally be written before DECLARE HANDLER raises a condition.
+    E.g. DECLARE var1 INTEGER DEFAULT 'get'.
+  */
+  if (!handler_entry)
+    DBUG_RETURN(false);
+
+  // Mark active conditions so that they can be deleted when the handler exits.
+  da->mark_sql_conditions_for_removal();
 
   uint continue_ip= handler_entry->handler->type == sp_handler::CONTINUE ?
     cur_spi->get_cont_dest() : 0;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (jon.hauglid:3422 to 3423) Jon Olav Hauglid5 Oct