#At file:///home/alik/MySQL/bzr/00/bug55843/mysql-5.5-bugteam-bug55843/ based on revid:alexander.nozdrin@stripped
3096 Alexander Nozdrin 2010-10-07
A patch for Bug#55843 (Handled condition appears as not handled).
Patch for Bug 23032 changed the behavior so that handled condition
(sql warning or exception) left in Warning_info. The problem was
that handled conditions were treated as unhandled ones, so they
were shown as "active statement" warnings.
This patch fixes this: handled condition is still kept in Warning_info,
but it is marked as handled, so it does not appear in a list of
"active statement" warnings.
modified:
mysql-test/mysql-test-run.pl
mysql-test/r/signal.result
mysql-test/r/sp-big.result
mysql-test/r/sp-bugs.result
mysql-test/r/sp-code.result
mysql-test/r/sp-error.result
mysql-test/r/sp.result
mysql-test/r/sp_trans.result
mysql-test/r/strict.result
mysql-test/r/view.result
mysql-test/suite/rpl/r/rpl_row_sp005.result
mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result
mysql-test/suite/rpl/r/rpl_row_trig003.result
sql/sp_head.cc
sql/sp_rcontext.cc
sql/sp_rcontext.h
sql/sql_error.cc
sql/sql_error.h
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2010-10-05 11:33:54 +0000
+++ b/mysql-test/mysql-test-run.pl 2010-10-07 08:21:15 +0000
@@ -162,7 +162,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG
# If you add a new suite, please check TEST_DIRS in Makefile.am.
#
-my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,rpl_ndb,ndb,innodb,perfschema";
+my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,perfschema";
my $opt_suites;
our $opt_verbose= 0; # Verbose output, enable with --verbose
=== modified file 'mysql-test/r/signal.result'
--- a/mysql-test/r/signal.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/signal.result 2010-10-07 08:21:15 +0000
@@ -1189,8 +1189,6 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
-Warnings:
-Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1206,8 +1204,6 @@ end $$
call test_signal() $$
Caught by number
Caught by number
-Warnings:
-Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1223,8 +1219,6 @@ end $$
call test_signal() $$
Caught by SQLWARNING
Caught by SQLWARNING
-Warnings:
-Warning 1012 Raising a warning
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1240,8 +1234,6 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
-Warnings:
-Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1257,8 +1249,6 @@ end $$
call test_signal() $$
Caught by number
Caught by number
-Warnings:
-Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1274,8 +1264,6 @@ end $$
call test_signal() $$
Caught by NOT FOUND
Caught by NOT FOUND
-Warnings:
-Error 1012 Raising a not found
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1291,8 +1279,6 @@ end $$
call test_signal() $$
Caught by SQLSTATE
Caught by SQLSTATE
-Warnings:
-Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1308,8 +1294,6 @@ end $$
call test_signal() $$
Caught by number
Caught by number
-Warnings:
-Error 1012 Raising an error
drop procedure test_signal $$
create procedure test_signal()
begin
@@ -1325,8 +1309,6 @@ end $$
call test_signal() $$
Caught by SQLEXCEPTION
Caught by SQLEXCEPTION
-Warnings:
-Error 1012 Raising an error
drop procedure test_signal $$
#
# Test where SIGNAL can be used
=== modified file 'mysql-test/r/sp-big.result'
--- a/mysql-test/r/sp-big.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp-big.result 2010-10-07 08:21:15 +0000
@@ -46,8 +46,6 @@ end while;
close cur1;
end|
call p1();
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t1;
count(*)
256
=== modified file 'mysql-test/r/sp-bugs.result'
--- a/mysql-test/r/sp-bugs.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp-bugs.result 2010-10-07 08:21:15 +0000
@@ -43,8 +43,6 @@ END|
SELECT f2 ();
f2 ()
NULL
-Warnings:
-Error 1305 FUNCTION testdb.f_not_exists does not exist
DROP SCHEMA testdb;
USE test;
#
=== modified file 'mysql-test/r/sp-code.result'
--- a/mysql-test/r/sp-code.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp-code.result 2010-10-07 08:21:15 +0000
@@ -711,8 +711,6 @@ looping i
looping 1
looping i
looping 0
-Warnings:
-Error 1062 Duplicate entry '1' for key 'a'
call proc_26977_works(2);
do something
do something
@@ -732,8 +730,6 @@ looping i
looping 0
optimizer: keep hreturn
optimizer: keep hreturn
-Warnings:
-Error 1062 Duplicate entry '2' for key 'a'
drop table t1;
drop procedure proc_26977_broken;
drop procedure proc_26977_works;
=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp-error.result 2010-10-07 08:21:15 +0000
@@ -1344,8 +1344,6 @@ set @in_func := 0;
select func_20713_a();
func_20713_a()
NULL
-Warnings:
-Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@@ -1353,8 +1351,6 @@ set @in_func := 0;
select func_20713_b();
func_20713_b()
NULL
-Warnings:
-Error 1146 Table 'test.bogus_table_20713' doesn't exist
select @in_func;
@in_func
2
@@ -1808,8 +1804,6 @@ c
1
Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 '
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
CALL p6();
CAST('10 ' as unsigned integer)
10
@@ -1817,8 +1811,6 @@ Level Code Message
Warning 1292 Truncated incorrect INTEGER value: '10 '
c
1
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
@@ -1889,8 +1881,6 @@ SET NEW.a = 10;
SET NEW.a = 99999999999;
END|
UPDATE t1 SET b = 20;
-Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
SHOW WARNINGS;
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
@@ -1945,8 +1935,6 @@ CALL p1();
NULL
warning caught (expected)
warning caught (expected)
-Warnings:
-Warning 1365 Division by 0
SHOW WARNINGS;
Level Code Message
Warning 1365 Division by 0
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp.result 2010-10-07 08:21:15 +0000
@@ -737,8 +737,6 @@ close c;
end|
insert into t2 values ("foo", 42, -1.9), ("bar", 3, 12.1), ("zap", 666, -3.14)|
call cur1()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t1|
id data
foo 40
@@ -774,8 +772,6 @@ close c1;
close c2;
end|
call cur2()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t3 order by i,s|
s i
bar 3
@@ -865,8 +861,6 @@ end$
set @@sql_mode = ''|
set sql_select_limit = 1|
call modes(@c1, @c2)|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
set sql_select_limit = default|
select @c1, @c2|
@c1 @c2
@@ -1688,64 +1682,42 @@ end|
call h_ee()|
h_ee
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_es()|
h_es
Outer (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_en()|
h_en
Outer (good)
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call h_ew()|
h_ew
Outer (good)
call h_ex()|
h_ex
Outer (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_se()|
h_se
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ss()|
h_ss
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_sn()|
h_sn
Outer (good)
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call h_sw()|
h_sw
Outer (good)
call h_sx()|
h_sx
Outer (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_ne()|
h_ne
Inner (good)
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call h_ns()|
h_ns
Inner (good)
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call h_nn()|
h_nn
Inner (good)
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call h_we()|
h_we
Inner (good)
@@ -1758,18 +1730,12 @@ Inner (good)
call h_xe()|
h_xe
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xs()|
h_xs
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
call h_xx()|
h_xx
Inner (good)
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop table t3|
drop procedure h_ee|
drop procedure h_es|
@@ -1918,8 +1884,6 @@ set @x2 = 2;
close c1;
end|
call bug2260()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select @x2|
@x2
2
@@ -2063,8 +2027,6 @@ insert into t3 values (123456789012);
insert into t3 values (0);
end|
call bug2780()|
-Warnings:
-Warning 1264 Out of range value for column 's1' at row 1
select @x|
@x
1
@@ -2487,8 +2449,6 @@ declare continue handler for sqlstate 'H
select s1 from t3 union select s2 from t3;
end|
call bug4904()|
-Warnings:
-Error 1267 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (latin2_general_ci,IMPLICIT) for operation 'UNION'
drop procedure bug4904|
drop table t3|
drop procedure if exists bug336|
@@ -2628,17 +2588,13 @@ select row_count()|
row_count()
1
call bug4905()|
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
--1
+0
call bug4905()|
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
select row_count()|
row_count()
--1
+0
select * from t3|
s1
1
@@ -2659,14 +2615,10 @@ insert into t3 values (1)|
call bug6029()|
sqlstate 23000
sqlstate 23000
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
delete from t3|
call bug6029()|
1136
1136
-Warnings:
-Error 1136 Column count doesn't match value count at row 1
drop procedure bug6029|
drop table t3|
drop procedure if exists bug8540|
@@ -2958,23 +2910,15 @@ end|
call bug6900()|
2
2
-Warnings:
-Error 1136 Column count doesn't match value count at row 1
call bug9074()|
x1 x2 x3 x4 x5 x6
1 1 1 1 1 1
-Warnings:
-Error 1062 Duplicate entry 'a' for key 'w'
call bug6900_9074(0)|
sqlexception
sqlexception
-Warnings:
-Error 1136 Column count doesn't match value count at row 1
call bug6900_9074(1)|
23000
23000
-Warnings:
-Error 1062 Duplicate entry 'a' for key 'w'
drop procedure bug6900|
drop procedure bug9074|
drop procedure bug6900_9074|
@@ -3017,13 +2961,9 @@ delete from t1|
call bug9856()|
16
16
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
call bug9856()|
16
16
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug9856|
drop procedure if exists bug9674_1|
drop procedure if exists bug9674_2|
@@ -3254,8 +3194,6 @@ x
2
x
3
-Warnings:
-Error 1326 Cursor is not open
call bug10961()|
x
1
@@ -3263,8 +3201,6 @@ x
2
x
3
-Warnings:
-Error 1326 Cursor is not open
drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
@@ -3380,11 +3316,7 @@ insert into t1 values
('Name4', 13),
('Name5', 14)|
call bug11529()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
call bug11529()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
delete from t1|
drop procedure bug11529|
set character set utf8|
@@ -3558,32 +3490,24 @@ end;
end if;
end|
call bug12168('a')|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
4
truncate t4|
call bug12168('a')|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
1
3
truncate t4|
call bug12168('b')|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select * from t4|
a
2
@@ -3883,8 +3807,6 @@ end|
call bug7049_2()|
Result
Caught it
-Warnings:
-Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
@@ -3892,16 +3814,12 @@ delete from t3|
call bug7049_4()|
Result
Caught it
-Warnings:
-Error 1062 Duplicate entry '42' for key 'x'
select * from t3|
x
42
select bug7049_2()|
bug7049_2()
1
-Warnings:
-Error 1062 Duplicate entry '42' for key 'x'
drop table t3|
drop procedure bug7049_1|
drop procedure bug7049_2|
@@ -4029,8 +3947,6 @@ end|
call bug14845()|
a
0
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
drop procedure bug14845|
drop procedure if exists bug13549_1|
drop procedure if exists bug13549_2|
@@ -4234,8 +4150,6 @@ end|
call bug13729()|
55
55
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
select * from t3|
s1
1
@@ -4272,15 +4186,11 @@ Handler
boo
v isnull(v)
NULL 1
-Warnings:
-Error 1054 Unknown column 'undefined_var' in 'field list'
call bug14643_2()|
Handler
boo
Handler
boo
-Warnings:
-Error 1054 Unknown column 'undefined_var' in 'field list'
drop procedure bug14643_1|
drop procedure bug14643_2|
drop procedure if exists bug14304|
@@ -4604,15 +4514,11 @@ Handler
error
End
done
-Warnings:
-Error 1054 Unknown column 'v' in 'field list'
call bug14498_2()|
Handler
error
End
done
-Warnings:
-Error 1054 Unknown column 'v' in 'field list'
call bug14498_3()|
v
maybe
@@ -4620,22 +4526,16 @@ Handler
error
End
done
-Warnings:
-Error 1054 Unknown column 'v' in 'field list'
call bug14498_4()|
Handler
error
End
done
-Warnings:
-Error 1054 Unknown column 'v' in 'field list'
call bug14498_5()|
Handler
error
End
done
-Warnings:
-Error 1054 Unknown column 'v' in 'field list'
drop procedure bug14498_1|
drop procedure bug14498_2|
drop procedure bug14498_3|
@@ -4700,8 +4600,6 @@ Before NOT FOUND condition is triggered
After NOT FOUND condtition is triggered
xid xdone
1 1
-Warnings:
-Warning 1329 No data - zero rows fetched, selected, or processed
call bug15231_3()|
Result
Missed it (correct)
@@ -4709,8 +4607,6 @@ Level Code Message
Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
Result
Caught it (correct)
-Warnings:
-Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1
call bug15231_5()|
Result
Missed it (correct)
@@ -4739,8 +4635,6 @@ end|
call bug15011()|
Handler
Inner
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
drop procedure bug15011|
drop table t3|
drop procedure if exists bug17476|
@@ -4816,8 +4710,6 @@ i
1
i
0
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
drop table t3|
drop procedure bug16887|
drop procedure if exists bug16474_1|
@@ -4890,8 +4782,6 @@ declare continue handler for sqlexceptio
select no_such_function();
end|
call bug18787()|
-Warnings:
-Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug18787|
create database bug18344_012345678901|
use bug18344_012345678901|
@@ -5265,8 +5155,6 @@ statement failed
statement failed
statement after update
statement after update
-Warnings:
-Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5278,8 +5166,6 @@ statement failed
statement failed
statement after update
statement after update
-Warnings:
-Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5312,8 +5198,6 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
-Warnings:
-Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5329,8 +5213,6 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
-Warnings:
-Error 1242 Subquery returns more than 1 row
select * from t3|
a
1
@@ -5364,8 +5246,6 @@ in continue handler
in continue handler
reachable code a2
reachable code a2
-Warnings:
-Error 1305 FUNCTION test.no_such_function does not exist
drop procedure bug8153_proc_a|
drop procedure bug8153_proc_b|
drop table t3|
@@ -5934,13 +5814,9 @@ end|
select func_8407_a()|
func_8407_a()
NULL
-Warnings:
-Error 1146 Table 'test.no_such_view' doesn't exist
select func_8407_b()|
func_8407_b()
1500
-Warnings:
-Error 1146 Table 'test.no_such_view' doesn't exist
drop function func_8407_a|
drop function func_8407_b|
drop table if exists table_26503|
@@ -6062,8 +5938,6 @@ looping i
looping 0
leaving handler
leaving handler
-Warnings:
-Error 1062 Duplicate entry '1' for key 'a'
call proc_26503_ok_2(2)|
do something
do something
@@ -6075,8 +5949,6 @@ looping i
looping 4
leaving handler
leaving handler
-Warnings:
-Error 1062 Duplicate entry '2' for key 'a'
call proc_26503_ok_3(3)|
do something
do something
@@ -6096,8 +5968,6 @@ looping i
looping 0
leaving handler
leaving handler
-Warnings:
-Error 1062 Duplicate entry '3' for key 'a'
call proc_26503_ok_4(4)|
do something
do something
@@ -6109,8 +5979,6 @@ looping i
looping 4
leaving handler
leaving handler
-Warnings:
-Error 1062 Duplicate entry '4' for key 'a'
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
@@ -6824,8 +6692,6 @@ DECLARE CONTINUE HANDLER FOR SQLEXCEPTIO
SELECT x FROM t1;
END|
CALL bug29770();
-Warnings:
-Error 1054 Unknown column 'x' in 'field list'
SELECT @state, @exception;
@state @exception
run NULL
@@ -6864,8 +6730,6 @@ end;
end while;
end//
call proc_33618(20);
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
drop table t_33618;
drop procedure proc_33618;
#
=== modified file 'mysql-test/r/sp_trans.result'
--- a/mysql-test/r/sp_trans.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/sp_trans.result 2010-10-07 08:21:15 +0000
@@ -99,8 +99,6 @@ return i;
end|
set @error_in_func:= 0|
insert into t1 values (bug10015_6(5)), (bug10015_6(6))|
-Warnings:
-Error 1062 Duplicate entry '1' for key 'PRIMARY'
select @error_in_func|
@error_in_func
1
@@ -526,8 +524,6 @@ until done end repeat;
close c;
end|
call bug14210()|
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
select count(*) from t4|
count(*)
256
=== modified file 'mysql-test/r/strict.result'
--- a/mysql-test/r/strict.result 2010-09-07 06:45:00 +0000
+++ b/mysql-test/r/strict.result 2010-10-07 08:21:15 +0000
@@ -1193,8 +1193,6 @@ select'a'; insert into t1 values (200);
call t1();
a
a
-Warnings:
-Error 1264 Out of range value for column 'col1' at row 1
select * from t1;
col1
drop procedure t1;
=== modified file 'mysql-test/r/view.result'
--- a/mysql-test/r/view.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/view.result 2010-10-07 08:21:15 +0000
@@ -3946,8 +3946,6 @@ create view a as select 1;
end|
call p();
call p();
-Warnings:
-Error 1050 Table 'a' already exists
drop view a;
drop procedure p;
#
=== modified file 'mysql-test/suite/rpl/r/rpl_row_sp005.result'
--- a/mysql-test/suite/rpl/r/rpl_row_sp005.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result 2010-10-07 08:21:15 +0000
@@ -77,8 +77,6 @@ id2
< ---- Master selects-- >
-------------------------
CALL test.p1();
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
SELECT * FROM test.t3 ORDER BY id3;
id3 c
1 MySQL
=== modified file 'mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result'
--- a/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result 2010-10-07 08:21:15 +0000
@@ -38,8 +38,6 @@ INSERT INTO t1 VALUES ('MySQL','1993-02-
END|
CALL p2();
CALL p1();
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
=== modified file 'mysql-test/suite/rpl/r/rpl_row_trig003.result'
--- a/mysql-test/suite/rpl/r/rpl_row_trig003.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_trig003.result 2010-10-07 08:21:15 +0000
@@ -69,15 +69,9 @@ INSERT INTO test.t2 VALUES(NULL,0,'Testi
UPDATE test.t1 SET b1 = 0 WHERE b1 = 1;
INSERT INTO test.t2 VALUES(NULL,1,'This is an after update test.', 'If this works, total will not be zero on the master or slave',1.4321,5.221,0,YEAR(NOW()),NOW());
UPDATE test.t2 SET b1 = 0 WHERE b1 = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
INSERT INTO test.t1 VALUES(NULL,1,'add some more test data test.', 'and hope for the best', 3.321,5.221,0,YEAR(NOW()),NOW());
DELETE FROM test.t1 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DELETE FROM test.t2 WHERE id = 1;
-Warnings:
-Error 1329 No data - zero rows fetched, selected, or processed
DROP TRIGGER test.t1_bi;
DROP TRIGGER test.t2_ai;
DROP TRIGGER test.t1_bu;
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2010-08-12 13:55:27 +0000
+++ b/sql/sp_head.cc 2010-10-07 08:21:15 +0000
@@ -1144,11 +1144,39 @@ find_handler_after_execution(THD *thd, s
{
if (thd->is_error())
{
+ List_iterator<MYSQL_ERROR> it(thd->warning_info->warn_list());
+ MYSQL_ERROR *err;
+ MYSQL_ERROR *error_in_warn_list= NULL;
+ while ((err= it++))
+ {
+ if (err->is_condition_handled() ||
+ err->get_level() != MYSQL_ERROR::WARN_LEVEL_ERROR ||
+ err->get_sql_errno() != thd->stmt_da->sql_errno() ||
+ strcmp(err->get_sqlstate(), thd->stmt_da->get_sqlstate()))
+ {
+ continue;
+ }
+
+ error_in_warn_list= err;
+ break;
+ }
+
+ /*
+ NOTE: error_in_warn_list can be NULL, i.e. current error can be not
+ in Warning_info. There may be two reasons for that:
+
+ - hackish no_warnings_for_error: if THD::no_warnings_for_error is
+ set, no warning is added into Warning_info when an error is risen.
+
+ - if max_error_count limits number of entries in Warning_info.
+ */
+
ctx->find_handler(thd,
thd->stmt_da->sql_errno(),
thd->stmt_da->get_sqlstate(),
MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->stmt_da->message());
+ thd->stmt_da->message(),
+ error_in_warn_list);
}
else if (thd->warning_info->statement_warn_count())
{
@@ -1156,15 +1184,17 @@ find_handler_after_execution(THD *thd, s
MYSQL_ERROR *err;
while ((err= it++))
{
- if (err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
- err->get_level() != MYSQL_ERROR::WARN_LEVEL_NOTE)
+ if (err->is_condition_handled() ||
+ (err->get_level() != MYSQL_ERROR::WARN_LEVEL_WARN &&
+ err->get_level() != MYSQL_ERROR::WARN_LEVEL_NOTE))
continue;
if (ctx->find_handler(thd,
err->get_sql_errno(),
err->get_sqlstate(),
err->get_level(),
- err->get_message_text()))
+ err->get_message_text(),
+ err))
{
break;
}
=== modified file 'sql/sp_rcontext.cc'
--- a/sql/sp_rcontext.cc 2010-07-30 15:28:36 +0000
+++ b/sql/sp_rcontext.cc 2010-10-07 08:21:15 +0000
@@ -36,6 +36,7 @@ sp_rcontext::sp_rcontext(sp_pcontext *ro
m_return_value_fld(return_value_fld),
m_return_value_set(FALSE),
in_sub_stmt(FALSE),
+ m_handled_conditions(NULL),
m_hcount(0),
m_hsp(0),
m_ihsp(0),
@@ -80,6 +81,9 @@ bool sp_rcontext::init(THD *thd)
for (i= 0; i<handler_count; i++)
m_raised_conditions[i].init(thd->mem_root);
+ if (!(m_handled_conditions= (MYSQL_ERROR **) thd->alloc(handler_count * sizeof (MYSQL_ERROR *))))
+ return TRUE;
+
return
!(m_handler=
(sp_handler_t*)thd->alloc(handler_count * sizeof(sp_handler_t))) ||
@@ -209,7 +213,8 @@ sp_rcontext::find_handler(THD *thd,
uint sql_errno,
const char *sqlstate,
MYSQL_ERROR::enum_warning_level level,
- const char *msg)
+ const char *msg,
+ MYSQL_ERROR *error)
{
int i= m_hcount;
@@ -276,6 +281,8 @@ sp_rcontext::find_handler(THD *thd,
m_raised_conditions[m_hfound].clear();
m_raised_conditions[m_hfound].set(sql_errno, sqlstate, level, msg);
+ m_handled_conditions[m_hfound]= error;
+
return TRUE;
}
@@ -288,7 +295,7 @@ sp_rcontext::find_handler(THD *thd,
level == MYSQL_ERROR::WARN_LEVEL_ERROR)
{
return m_prev_runtime_ctx->find_handler(thd, sql_errno, sqlstate,
- level, msg);
+ level, msg, error);
}
return FALSE;
@@ -387,6 +394,9 @@ sp_rcontext::activate_handler(THD *thd,
if (m_hfound < 0)
return FALSE;
+ if (m_handled_conditions[m_hfound])
+ m_handled_conditions[m_hfound]->set_condition_handled();
+
switch (m_handler[m_hfound].type) {
case SP_HANDLER_NONE:
break;
=== modified file 'sql/sp_rcontext.h'
--- a/sql/sp_rcontext.h 2010-07-30 15:28:36 +0000
+++ b/sql/sp_rcontext.h 2010-10-07 08:21:15 +0000
@@ -144,7 +144,8 @@ class sp_rcontext : public Sql_alloc
uint sql_errno,
const char *sqlstate,
MYSQL_ERROR::enum_warning_level level,
- const char *msg);
+ const char *msg,
+ MYSQL_ERROR *error);
MYSQL_ERROR *
raised_condition() const;
@@ -233,6 +234,8 @@ private:
*/
MYSQL_ERROR *m_raised_conditions;
+ MYSQL_ERROR **m_handled_conditions;
+
uint m_hcount; // Stack pointer for m_handler
uint *m_hstack; // Return stack for continue handlers
uint m_hsp; // Stack pointer for m_hstack
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2010-07-30 15:28:36 +0000
+++ b/sql/sql_error.cc 2010-10-07 08:21:15 +0000
@@ -187,7 +187,8 @@ MYSQL_ERROR::MYSQL_ERROR()
m_message_text(),
m_sql_errno(0),
m_level(MYSQL_ERROR::WARN_LEVEL_ERROR),
- m_mem_root(NULL)
+ m_mem_root(NULL),
+ m_condition_handled(FALSE)
{
memset(m_returned_sqlstate, 0, sizeof(m_returned_sqlstate));
}
@@ -214,6 +215,7 @@ void MYSQL_ERROR::clear()
m_message_text.length(0);
m_sql_errno= 0;
m_level= MYSQL_ERROR::WARN_LEVEL_ERROR;
+ m_condition_handled= FALSE;
}
MYSQL_ERROR::MYSQL_ERROR(MEM_ROOT *mem_root)
@@ -231,7 +233,8 @@ MYSQL_ERROR::MYSQL_ERROR(MEM_ROOT *mem_r
m_message_text(),
m_sql_errno(0),
m_level(MYSQL_ERROR::WARN_LEVEL_ERROR),
- m_mem_root(mem_root)
+ m_mem_root(mem_root),
+ m_condition_handled(FALSE)
{
DBUG_ASSERT(mem_root != NULL);
memset(m_returned_sqlstate, 0, sizeof(m_returned_sqlstate));
@@ -268,6 +271,7 @@ MYSQL_ERROR::copy_opt_attributes(const M
copy_string(m_mem_root, & m_table_name, & cond->m_table_name);
copy_string(m_mem_root, & m_column_name, & cond->m_column_name);
copy_string(m_mem_root, & m_cursor_name, & cond->m_cursor_name);
+ m_condition_handled= cond->m_condition_handled;
}
void
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2010-07-30 15:28:36 +0000
+++ b/sql/sql_error.h 2010-10-07 08:21:15 +0000
@@ -200,6 +200,12 @@ public:
MYSQL_ERROR::enum_warning_level get_level() const
{ return m_level; }
+ bool is_condition_handled() const
+ { return m_condition_handled; }
+
+ void set_condition_handled()
+ { m_condition_handled= TRUE; }
+
private:
/*
The interface of MYSQL_ERROR is mostly private, by design,
@@ -326,6 +332,9 @@ private:
/** Memory root to use to hold condition item values. */
MEM_ROOT *m_mem_root;
+
+ /** Flag to specify if this condition has been already handled. */
+ bool m_condition_handled;
};
///////////////////////////////////////////////////////////////////////////
@@ -411,6 +420,9 @@ public:
err->get_level(), err->get_message_text());
if (copy)
copy->copy_opt_attributes(err);
+
+ if (err->is_condition_handled())
+ --m_statement_warn_count;
}
}
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20101007082115-514v0m71bcjsbnj7.bundle