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, 2007-03-06 18:26:23-07:00, malff@weblab.(none) +5 -0
Merge malff@stripped:/home/bk/mysql-5.0-runtime
into weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
MERGE: 1.2438.1.2
mysql-test/r/sp.result@stripped, 2007-03-06 18:26:19-07:00, malff@weblab.(none) +0 -0
Auto merged
MERGE: 1.214.1.5
mysql-test/r/trigger.result@stripped, 2007-03-06 18:26:19-07:00, malff@weblab.(none) +0 -0
Auto merged
MERGE: 1.47.1.8
mysql-test/t/sp.test@stripped, 2007-03-06 18:26:20-07:00, malff@weblab.(none) +0 -0
Auto merged
MERGE: 1.205.1.4
mysql-test/t/trigger.test@stripped, 2007-03-06 18:26:20-07:00, malff@weblab.(none) +0 -0
Auto merged
MERGE: 1.53.1.9
sql/sp_head.cc@stripped, 2007-03-06 18:26:20-07:00, malff@weblab.(none) +0 -0
Auto merged
MERGE: 1.224.1.12
# 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-runtime/RESYNC
--- 1.53/mysql-test/r/trigger.result 2007-03-06 18:26:30 -07:00
+++ 1.54/mysql-test/r/trigger.result 2007-03-06 18:26:30 -07:00
@@ -1335,4 +1335,41 @@ SELECT fubar_id FROM t2;
fubar_id
1
DROP TABLE t1,t2;
+DROP TABLE IF EXISTS bug21825_A;
+DROP TABLE IF EXISTS bug21825_B;
+CREATE TABLE bug21825_A (id int(10));
+CREATE TABLE bug21825_B (id int(10));
+CREATE TRIGGER trgA AFTER INSERT ON bug21825_A
+FOR EACH ROW
+BEGIN
+INSERT INTO bug21825_B (id) values (1);
+END//
+INSERT INTO bug21825_A (id) VALUES (10);
+INSERT INTO bug21825_A (id) VALUES (20);
+DROP TABLE bug21825_B;
+DELETE FROM bug21825_A WHERE id = 20;
+DROP TABLE bug21825_A;
+DROP TABLE IF EXISTS bug22580_t1;
+DROP PROCEDURE IF EXISTS bug22580_proc_1;
+DROP PROCEDURE IF EXISTS bug22580_proc_2;
+CREATE TABLE bug22580_t1 (a INT, b INT);
+CREATE PROCEDURE bug22580_proc_2()
+BEGIN
+DROP TABLE IF EXISTS bug22580_tmp;
+CREATE TEMPORARY TABLE bug22580_tmp (a INT);
+DROP TABLE bug22580_tmp;
+END||
+CREATE PROCEDURE bug22580_proc_1()
+BEGIN
+CALL bug22580_proc_2();
+END||
+CREATE TRIGGER t1bu BEFORE UPDATE ON bug22580_t1
+FOR EACH ROW
+BEGIN
+CALL bug22580_proc_1();
+END||
+INSERT INTO bug22580_t1 VALUES (1,1);
+DROP TABLE bug22580_t1;
+DROP PROCEDURE bug22580_proc_1;
+DROP PROCEDURE bug22580_proc_2;
End of 5.0 tests
--- 1.60/mysql-test/t/trigger.test 2007-03-06 18:26:30 -07:00
+++ 1.61/mysql-test/t/trigger.test 2007-03-06 18:26:30 -07:00
@@ -1625,4 +1625,78 @@ SELECT fubar_id FROM t2;
DROP TABLE t1,t2;
+#
+# Bug#21285 (Incorrect message error deleting records in a table with a
+# trigger for inserting)
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS bug21825_A;
+DROP TABLE IF EXISTS bug21825_B;
+--enable_warnings
+
+CREATE TABLE bug21825_A (id int(10));
+CREATE TABLE bug21825_B (id int(10));
+
+delimiter //;
+
+CREATE TRIGGER trgA AFTER INSERT ON bug21825_A
+FOR EACH ROW
+BEGIN
+ INSERT INTO bug21825_B (id) values (1);
+END//
+delimiter ;//
+
+INSERT INTO bug21825_A (id) VALUES (10);
+INSERT INTO bug21825_A (id) VALUES (20);
+
+DROP TABLE bug21825_B;
+
+# Must pass, the missing table in the insert trigger should not matter.
+DELETE FROM bug21825_A WHERE id = 20;
+
+DROP TABLE bug21825_A;
+
+#
+# Bug#22580 (DROP TABLE in nested stored procedure causes strange dependancy
+# error)
+#
+
+--disable_warnings
+DROP TABLE IF EXISTS bug22580_t1;
+DROP PROCEDURE IF EXISTS bug22580_proc_1;
+DROP PROCEDURE IF EXISTS bug22580_proc_2;
+--enable_warnings
+
+CREATE TABLE bug22580_t1 (a INT, b INT);
+
+DELIMITER ||;
+
+CREATE PROCEDURE bug22580_proc_2()
+BEGIN
+ DROP TABLE IF EXISTS bug22580_tmp;
+ CREATE TEMPORARY TABLE bug22580_tmp (a INT);
+ DROP TABLE bug22580_tmp;
+END||
+
+CREATE PROCEDURE bug22580_proc_1()
+BEGIN
+ CALL bug22580_proc_2();
+END||
+
+CREATE TRIGGER t1bu BEFORE UPDATE ON bug22580_t1
+FOR EACH ROW
+BEGIN
+ CALL bug22580_proc_1();
+END||
+
+DELIMITER ;||
+
+# Must pass, the actions of the update trigger should not matter
+INSERT INTO bug22580_t1 VALUES (1,1);
+
+DROP TABLE bug22580_t1;
+DROP PROCEDURE bug22580_proc_1;
+DROP PROCEDURE bug22580_proc_2;
+
--echo End of 5.0 tests
--- 1.219/mysql-test/r/sp.result 2007-03-06 18:26:30 -07:00
+++ 1.220/mysql-test/r/sp.result 2007-03-06 18:26:30 -07:00
@@ -1155,9 +1155,13 @@ create function f12_2() returns int
return (select count(*) from t3)|
drop temporary table t3|
select f12_1()|
-ERROR 42S02: Table 'test.t3' doesn't exist
+f12_1()
+3
+Warnings:
+Note 1051 Unknown table 't3'
select f12_1() from t1 limit 1|
-ERROR 42S02: Table 'test.t3' doesn't exist
+f12_1()
+3
drop function f0|
drop function f1|
drop function f2|
@@ -5741,4 +5745,38 @@ END|
CALL bug24117()|
DROP PROCEDURE bug24117|
DROP TABLE t3|
+drop function if exists func_8407_a|
+drop function if exists func_8407_b|
+create function func_8407_a() returns int
+begin
+declare x int;
+declare continue handler for sqlexception
+begin
+end;
+select 1 from no_such_view limit 1 into x;
+return x;
+end|
+create function func_8407_b() returns int
+begin
+declare x int default 0;
+declare continue handler for sqlstate '42S02'
+ begin
+set x:= x+1000;
+end;
+case (select 1 from no_such_view limit 1)
+when 1 then set x:= x+1;
+when 2 then set x:= x+2;
+else set x:= x+100;
+end case;
+set x:=x + 500;
+return x;
+end|
+select func_8407_a()|
+func_8407_a()
+NULL
+select func_8407_b()|
+func_8407_b()
+1500
+drop function func_8407_a|
+drop function func_8407_b|
drop table t1,t2;
--- 1.208/mysql-test/t/sp.test 2007-03-06 18:26:30 -07:00
+++ 1.209/mysql-test/t/sp.test 2007-03-06 18:26:30 -07:00
@@ -1368,7 +1368,7 @@ end|
select f11()|
--error ER_CANT_REOPEN_TABLE
select f11() from t1|
-# We don't handle temporary tables used by nested functions well
+# Test that using a single table instance at a time works
create function f12_1() returns int
begin
drop temporary table if exists t3;
@@ -1378,11 +1378,9 @@ begin
end|
create function f12_2() returns int
return (select count(*) from t3)|
-# We need clean start to get error
+
drop temporary table t3|
---error ER_NO_SUCH_TABLE
select f12_1()|
---error ER_NO_SUCH_TABLE
select f12_1() from t1 limit 1|
# Cleanup
@@ -6713,6 +6711,53 @@ END|
CALL bug24117()|
DROP PROCEDURE bug24117|
DROP TABLE t3|
+
+#
+# Bug#8407(Stored functions/triggers ignore exception handler)
+#
+
+--disable_warnings
+drop function if exists func_8407_a|
+drop function if exists func_8407_b|
+--enable_warnings
+
+create function func_8407_a() returns int
+begin
+ declare x int;
+
+ declare continue handler for sqlexception
+ begin
+ end;
+
+ select 1 from no_such_view limit 1 into x;
+
+ return x;
+end|
+
+create function func_8407_b() returns int
+begin
+ declare x int default 0;
+
+ declare continue handler for sqlstate '42S02'
+ begin
+ set x:= x+1000;
+ end;
+
+ case (select 1 from no_such_view limit 1)
+ when 1 then set x:= x+1;
+ when 2 then set x:= x+2;
+ else set x:= x+100;
+ end case;
+ set x:=x + 500;
+
+ return x;
+end|
+
+select func_8407_a()|
+select func_8407_b()|
+
+drop function func_8407_a|
+drop function func_8407_b|
#
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
--- 1.231/sql/sp_head.cc 2007-03-06 18:26:30 -07:00
+++ 1.232/sql/sp_head.cc 2007-03-06 18:26:30 -07:00
@@ -2390,16 +2390,11 @@ sp_lex_keeper::reset_lex_and_exec_core(T
m_lex->mark_as_requiring_prelocking(lex_query_tables_own_last);
}
}
-
+
reinit_stmt_before_use(thd, m_lex);
- /*
- If requested check whenever we have access to tables in LEX's table list
- and open and lock them before executing instructtions core function.
- */
- if (open_tables &&
- (check_table_access(thd, SELECT_ACL, m_lex->query_tables, 0) ||
- open_and_lock_tables(thd, m_lex->query_tables)))
- res= -1;
+
+ if (open_tables)
+ res= instr->exec_open_and_lock_tables(thd, m_lex->query_tables, nextp);
if (!res)
res= instr->exec_core(thd, nextp);
@@ -2448,6 +2443,33 @@ sp_lex_keeper::reset_lex_and_exec_core(T
sp_instr class functions
*/
+int sp_instr::exec_open_and_lock_tables(THD *thd, TABLE_LIST *tables,
+ uint *nextp)
+{
+ int result;
+
+ /*
+ Check whenever we have access to tables for this statement
+ and open and lock them before executing instructions core function.
+ */
+ if (check_table_access(thd, SELECT_ACL, tables, 0)
+ || open_and_lock_tables(thd, tables))
+ {
+ get_cont_dest(nextp);
+ result= -1;
+ }
+ else
+ result= 0;
+
+ return result;
+}
+
+void sp_instr::get_cont_dest(uint *nextp)
+{
+ *nextp= m_ip+1;
+}
+
+
int sp_instr::exec_core(THD *thd, uint *nextp)
{
DBUG_ASSERT(0);
@@ -2626,6 +2648,15 @@ sp_instr_set_trigger_field::print(String
trigger_field->print(str);
str->append(STRING_WITH_LEN(":="));
value->print(str);
+}
+
+/*
+ sp_instr_opt_meta
+*/
+
+void sp_instr_opt_meta::get_cont_dest(uint *nextp)
+{
+ *nextp= m_cont_dest;
}
| Thread |
|---|
| • bk commit into 5.0 tree (malff:1.2440) | marc.alff | 7 Mar |