List:Commits« Previous MessageNext Message »
From:Jon Olav Hauglid Date:October 4 2011 9:07am
Subject:bzr push into mysql-trunk branch (jon.hauglid:3425 to 3426) WL#5986
View as plain text  
 3426 Jon Olav Hauglid	2011-10-04
      WL#5986: Stored programs: Make condition handlers closer to the standard.
      
      Fix assertion failure if a variable declaration raises a warning
      and a warning handler is declared. The assertion was triggered
      because the parser thought the handler should be activated, yet
      at runtime the handler declaration had not been processed yet.
      
      This patch fixes the assertion by not activating the handler in
      such cases (this matches the current 5.5/5.6 behavior).
      
      Test case added to sp-error.test.

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

    removed:
      mysql-test/std_data/bug57108.cnf
      scripts/make_binary_distribution.sh
      scripts/make_win_bin_dist
    added:
      mysql-test/r/auth_rpl.result
      mysql-test/suite/opt_trace/include/filesort_pq.inc
      mysql-test/suite/opt_trace/r/filesort_pq.result
      mysql-test/suite/opt_trace/t/filesort_pq.test
      mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt
      mysql-test/t/auth_rpl-master.opt
      mysql-test/t/auth_rpl-slave.opt
      mysql-test/t/auth_rpl.test
      unittest/gunit/decimal-t.cc
    modified:
      CMakeLists.txt
      VERSION
      client/mysqltest.cc
      cmake/build_configurations/mysql_release.cmake
      cmake/install_macros.cmake
      config.h.cmake
      dbug/dbug.c
      extra/innochecksum.c
      include/decimal.h
      include/my_base.h
      include/mysql/psi/mysql_socket.h
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      libmysql/client_settings.h
      mysql-test/collections/disabled-daily.list
      mysql-test/collections/disabled-weekly.list
      mysql-test/include/icp_tests.inc
      mysql-test/include/mtr_check.sql
      mysql-test/include/mysqld--help.inc
      mysql-test/include/range.inc
      mysql-test/include/subquery.inc
      mysql-test/include/subquery_sj.inc
      mysql-test/lib/mtr_cases.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/alter_table.result
      mysql-test/r/derived.result
      mysql-test/r/execution_constants.result
      mysql-test/r/func_math.result
      mysql-test/r/func_str.result
      mysql-test/r/group_by.result
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mrr_cost_icp.result
      mysql-test/r/innodb_mrr_icp.result
      mysql-test/r/join.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/myisampack.result
      mysql-test/r/mysqltest.result
      mysql-test/r/partition_innodb.result
      mysql-test/r/query_cache.result
      mysql-test/r/range_all.result
      mysql-test/r/range_icp.result
      mysql-test/r/range_icp_mrr.result
      mysql-test/r/range_mrr.result
      mysql-test/r/range_mrr_cost.result
      mysql-test/r/range_none.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_bka.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_bka.result
      mysql-test/r/subquery_nomat_nosj_bka_nobnl.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_bka.result
      mysql-test/r/subquery_none_bka_nobnl.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nobnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/r/type_newdecimal.result
      mysql-test/r/view_grant.result
      mysql-test/suite/innodb/r/innodb-index.result
      mysql-test/suite/innodb/t/innodb-index.test
      mysql-test/suite/opt_trace/r/bugs_no_prot_none.result
      mysql-test/suite/opt_trace/r/bugs_ps_prot_none.result
      mysql-test/suite/opt_trace/r/general2_no_prot.result
      mysql-test/suite/opt_trace/r/general2_ps_prot.result
      mysql-test/suite/opt_trace/r/general_no_prot_none.result
      mysql-test/suite/opt_trace/r/general_ps_prot_none.result
      mysql-test/suite/opt_trace/r/range_no_prot.result
      mysql-test/suite/opt_trace/r/range_ps_prot.result
      mysql-test/suite/perfschema/include/socket_summary_check.inc
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/socket_summary_by_instance_func.result
      mysql-test/suite/perfschema/r/socket_summary_by_instance_func_win.result
      mysql-test/suite/perfschema/t/socket_instances_func.test
      mysql-test/suite/perfschema/t/socket_instances_func_win.test
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test
      mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test
      mysql-test/suite/rpl/r/rpl_row_ignorable_event.result
      mysql-test/suite/rpl/r/rpl_slave_load_remove_tmpfile.result
      mysql-test/suite/rpl/r/rpl_spec_variables.result
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/suite/rpl/t/rpl_row_ignorable_event.test
      mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test
      mysql-test/suite/rpl/t/rpl_spec_variables.test
      mysql-test/suite/sys_vars/r/plugin_dir_basic.result
      mysql-test/suite/sys_vars/t/plugin_dir_basic.test
      mysql-test/t/alter_table.test
      mysql-test/t/derived.test
      mysql-test/t/execution_constants.test
      mysql-test/t/func_math.test
      mysql-test/t/func_str.test
      mysql-test/t/group_by.test
      mysql-test/t/join.test
      mysql-test/t/multi_plugin_load.test
      mysql-test/t/myisampack.test
      mysql-test/t/mysqltest.test
      mysql-test/t/partition_innodb.test
      mysql-test/t/query_cache.test
      mysql-test/t/type_newdecimal.test
      mysql-test/t/view_grant.test
      mysql-test/valgrind.supp
      mysys/my_handler_errors.h
      mysys/psi_noop.cc
      plugin/semisync/semisync_master.cc
      scripts/CMakeLists.txt
      scripts/mysql_install_db.pl.in
      scripts/mysql_install_db.sh
      scripts/mysql_system_tables.sql
      sql/CMakeLists.txt
      sql/client_settings.h
      sql/filesort.cc
      sql/handler.cc
      sql/item.cc
      sql/item.h
      sql/my_decimal.h
      sql/opt_range.cc
      sql/opt_trace.h
      sql/records.cc
      sql/rpl_slave.cc
      sql/share/errmsg-utf8.txt
      sql/sql_base.cc
      sql/sql_cache.cc
      sql/sql_select.cc
      sql/sql_table.cc
      sql/sql_test.cc
      sql/sql_test.h
      sql/sql_update.cc
      sql/table.cc
      sql/table.h
      sql/uniques.cc
      storage/innobase/CMakeLists.txt
      storage/innobase/btr/btr0btr.c
      storage/innobase/btr/btr0cur.c
      storage/innobase/buf/buf0buddy.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/buf/buf0checksum.c
      storage/innobase/buf/buf0flu.c
      storage/innobase/data/data0data.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0load.c
      storage/innobase/dict/dict0stats.c
      storage/innobase/fil/fil0fil.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/ibuf/ibuf0ibuf.c
      storage/innobase/include/btr0btr.h
      storage/innobase/include/btr0btr.ic
      storage/innobase/include/btr0cur.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
      storage/innobase/include/buf0checksum.h
      storage/innobase/include/buf0types.h
      storage/innobase/include/data0data.ic
      storage/innobase/include/data0type.ic
      storage/innobase/include/db0err.h
      storage/innobase/include/dict0dict.h
      storage/innobase/include/dict0dict.ic
      storage/innobase/include/dict0load.h
      storage/innobase/include/fsp0fsp.h
      storage/innobase/include/mtr0mtr.h
      storage/innobase/include/mtr0mtr.ic
      storage/innobase/include/page0page.h
      storage/innobase/include/page0page.ic
      storage/innobase/include/page0zip.ic
      storage/innobase/include/rem0rec.ic
      storage/innobase/include/row0upd.ic
      storage/innobase/include/srv0srv.h
      storage/innobase/include/sync0sync.h
      storage/innobase/include/sync0sync.ic
      storage/innobase/include/trx0sys.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/trx0undo.h
      storage/innobase/include/univ.i
      storage/innobase/mtr/mtr0log.c
      storage/innobase/mtr/mtr0mtr.c
      storage/innobase/page/page0cur.c
      storage/innobase/page/page0page.c
      storage/innobase/page/page0zip.c
      storage/innobase/rem/rem0cmp.c
      storage/innobase/row/row0ins.c
      storage/innobase/row/row0merge.c
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0row.c
      storage/innobase/row/row0sel.c
      storage/innobase/row/row0upd.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/srv/srv0start.c
      storage/innobase/sync/sync0sync.c
      storage/innobase/trx/trx0rec.c
      storage/innobase/trx/trx0undo.c
      storage/innobase/ut/ut0ut.c
      storage/myisam/ft_boolean_search.c
      storage/myisam/ft_nlq_search.c
      storage/myisam/ha_myisam.cc
      storage/myisam/mi_check.c
      storage/myisam/mi_write.c
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_account.cc
      storage/perfschema/pfs_host.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_setup_actor.cc
      storage/perfschema/pfs_setup_object.cc
      storage/perfschema/pfs_user.cc
      strings/decimal.c
      strings/dtoa.c
      support-files/mysql.spec.sh
      unittest/gunit/CMakeLists.txt
      unittest/gunit/my_decimal-t.cc
=== 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:3425 to 3426) WL#5986Jon Olav Hauglid5 Oct