#At file:///home/alik/MySQL/bzr/00/bug55843/2011.05.19/mysql-5.5/ based on revid:alexander.nozdrin@stripped
3391 Alexander Nozdrin 2011-05-19
A patch for Bug#11763162 (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.
The bug fix is to remove handled SQL conditions from Warning_info.
modified:
mysql-test/r/signal.result
mysql-test/r/signal_demo3.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/t/sp-error.test
sql/sp_head.cc
sql/sql_error.cc
sql/sql_error.h
sql/sql_signal.cc
=== modified file 'mysql-test/r/signal.result'
--- a/mysql-test/r/signal.result 2010-10-26 11:48:08 +0000
+++ b/mysql-test/r/signal.result 2011-05-19 12:07:04 +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
@@ -1466,7 +1448,6 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1012 Raising a warning
-Warning 1012 Raising a warning
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1521,7 +1502,6 @@ after RESIGNAL
after RESIGNAL
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
-Warning 1264 Out of range value for column 'a' at row 1
drop procedure test_resignal $$
create procedure test_resignal()
begin
@@ -1578,7 +1558,6 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
-Warning 1012 Raising a warning
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@@ -1639,7 +1618,6 @@ before RESIGNAL
after RESIGNAL
after RESIGNAL
Warnings:
-Warning 1264 Out of range value for column 'a' at row 1
Warning 5555 RESIGNAL of a warning
drop procedure test_resignal $$
create procedure test_resignal()
@@ -2141,9 +2119,6 @@ CALL peter_p2() $$
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
-Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
-Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
-Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Hi, I am a useless error message
drop procedure peter_p1 $$
drop procedure peter_p2 $$
@@ -2188,18 +2163,15 @@ CALL peter_p2() $$
1
1
Level Code Message
-Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
2
2
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
-Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
3
3
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
-Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
=== modified file 'mysql-test/r/signal_demo3.result'
--- a/mysql-test/r/signal_demo3.result 2010-07-30 15:28:36 +0000
+++ b/mysql-test/r/signal_demo3.result 2011-05-19 12:07:04 +0000
@@ -95,11 +95,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Error 1051 Unknown table 'oops_it_is_not_here'
-Error 1644 Oops in proc_9
-Error 1644 Oops in proc_8
-Error 1644 Oops in proc_7
-Error 1644 Oops in proc_6
+Error 1644 Oops in proc_5
+Error 1644 Oops in proc_4
+Error 1644 Oops in proc_3
+Error 1644 Oops in proc_2
+Error 1644 Oops in proc_1
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -108,13 +108,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Error 1051 Unknown table 'oops_it_is_not_here'
-Error 1644 Oops in proc_9
-Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
Error 1644 Oops in proc_6
Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
+Error 1644 Oops in proc_3
+Error 1644 Oops in proc_2
+Error 1644 Oops in proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@@ -123,7 +123,6 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
-Error 1051 Unknown table 'oops_it_is_not_here'
Error 1644 Oops in proc_9
Error 1644 Oops in proc_8
Error 1644 Oops in proc_7
@@ -132,6 +131,7 @@ Error 1644 Oops in proc_5
Error 1644 Oops in proc_4
Error 1644 Oops in proc_3
Error 1644 Oops in proc_2
+Error 1644 Oops in proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;
=== 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 2011-05-19 12:07:04 +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-11-11 05:06:16 +0000
+++ b/mysql-test/r/sp-bugs.result 2011-05-19 12:07:04 +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 2011-02-16 16:27:35 +0000
+++ b/mysql-test/r/sp-code.result 2011-05-19 12:07:04 +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;
@@ -928,20 +924,16 @@ CALL p1();
Warning found!
Warning found!
Level Code Message
-Warning 1105 Unknown error
Warning found!
Warning found!
Level Code Message
-Warning 1105 Unknown error
Warning found!
Warning found!
Level Code Message
-Warning 1105 Unknown error
End of Result Set found!
End of Result Set found!
Level Code Message
Warning 1105 Unknown error
-Error 1329 No data - zero rows fetched, selected, or processed
SET SESSION debug="-d,bug23032_emit_warning";
DROP PROCEDURE p1;
DROP TABLE t1;
=== modified file 'mysql-test/r/sp-error.result'
--- a/mysql-test/r/sp-error.result 2010-10-26 11:48:08 +0000
+++ b/mysql-test/r/sp-error.result 2011-05-19 12:07:04 +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
@@ -1754,77 +1750,103 @@ DROP PROCEDURE p2;
# - Case 2
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
-CALL p2();
-CALL p3();
-CALL p4();
+DECLARE CONTINUE HANDLER FOR SQLWARNING
+BEGIN
+SET c = c + 1;
+SELECT 'Warning caught!' AS Msg;
+END;
+CALL p2(); # 1 warning
+CALL p3(); # 1 warning
+CALL p4(); # No warnings
+CALL p5(); # 1 warning
SELECT c;
SELECT @@warning_count;
SHOW WARNINGS;
END|
CREATE PROCEDURE p2()
BEGIN
-SELECT CAST('10 ' as unsigned integer);
+SELECT CAST('2 ' as unsigned integer);
END|
CREATE PROCEDURE p3()
BEGIN
-SELECT CAST('10 ' as unsigned integer);
-SELECT 1;
+SELECT CAST('3 ' as unsigned integer);
+SELECT 1; # does not clear the warning
END|
CREATE PROCEDURE p4()
BEGIN
-SELECT CAST('10 ' as unsigned integer);
-CALL p2();
+SELECT CAST('4 ' as unsigned integer);
+INSERT INTO t1 VALUES(1); # Clears the warning
END|
CREATE PROCEDURE p5()
BEGIN
-SELECT CAST('10 ' as unsigned integer);
+SELECT CAST('5 ' as unsigned integer);
+CALL p2();
+END|
+CREATE PROCEDURE p6()
+BEGIN
+SELECT CAST('6 ' as unsigned integer);
SHOW WARNINGS;
END|
-CREATE PROCEDURE P6()
+CREATE PROCEDURE p7()
BEGIN
DECLARE c INT DEFAULT 0;
-DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
-CALL p5();
+DECLARE CONTINUE HANDLER FOR SQLWARNING
+BEGIN
+SET c = c + 1;
+SELECT 'Warning caught!' AS Msg;
+END;
+CALL p6();
SELECT c;
END|
+
CALL p1();
-CAST('10 ' as unsigned integer)
-10
-CAST('10 ' as unsigned integer)
-10
+CAST('2 ' as unsigned integer)
+2
+Msg
+Warning caught!
+CAST('3 ' as unsigned integer)
+3
1
1
-CAST('10 ' as unsigned integer)
-10
-CAST('10 ' as unsigned integer)
-10
+Msg
+Warning caught!
+CAST('4 ' as unsigned integer)
+4
+CAST('5 ' as unsigned integer)
+5
+CAST('2 ' as unsigned integer)
+2
+Msg
+Warning caught!
c
3
@@warning_count
-1
+0
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
+
+CALL p7();
+CAST('6 ' as unsigned integer)
+6
Level Code Message
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+Warning 1292 Truncated incorrect INTEGER value: '6 '
+Msg
+Warning caught!
c
1
-Warnings:
-Warning 1292 Truncated incorrect INTEGER value: '10 '
+
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP PROCEDURE p5;
DROP PROCEDURE p6;
+DROP PROCEDURE p7;
+DROP TABLE t1;
# - Case 3: check that "Exception trumps No Data".
@@ -1871,7 +1893,6 @@ exception
exception
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '10 '
-Error 1048 Column 'b' cannot be null
DROP TABLE t1;
DROP PROCEDURE p1;
#
@@ -1915,11 +1936,8 @@ 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
CALL p2();
5 / 0
NULL
=== modified file 'mysql-test/r/sp.result'
--- a/mysql-test/r/sp.result 2011-03-17 11:02:19 +0000
+++ b/mysql-test/r/sp.result 2011-05-19 12:07:04 +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-10-06 14:34:28 +0000
+++ b/mysql-test/r/sp_trans.result 2011-05-19 12:07:04 +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 2011-05-19 12:07:04 +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 2011-04-08 08:09:24 +0000
+++ b/mysql-test/r/view.result 2011-05-19 12:07:04 +0000
@@ -3948,8 +3948,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-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp005.result 2011-05-19 12:07:04 +0000
@@ -73,8 +73,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-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_sp006_InnoDB.result 2011-05-19 12:07:04 +0000
@@ -34,8 +34,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/t/sp-error.test'
--- a/mysql-test/t/sp-error.test 2010-10-26 11:48:08 +0000
+++ b/mysql-test/t/sp-error.test 2011-05-19 12:07:04 +0000
@@ -2585,15 +2585,26 @@ DROP PROCEDURE p2;
--echo # - Case 2
--echo
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+
delimiter |;
CREATE PROCEDURE p1()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
- CALL p2();
- CALL p3();
- CALL p4();
+ DECLARE CONTINUE HANDLER FOR SQLWARNING
+ BEGIN
+ SET c = c + 1;
+ SELECT 'Warning caught!' AS Msg;
+ END;
+ CALL p2(); # 1 warning
+ CALL p3(); # 1 warning
+ CALL p4(); # No warnings
+ CALL p5(); # 1 warning
SELECT c;
SELECT @@warning_count;
SHOW WARNINGS;
@@ -2601,39 +2612,54 @@ CREATE PROCEDURE p1()
CREATE PROCEDURE p2()
BEGIN
- SELECT CAST('10 ' as unsigned integer);
- END|
+ SELECT CAST('2 ' as unsigned integer);
+ END| # 1 warning is passed to the caller
CREATE PROCEDURE p3()
BEGIN
- SELECT CAST('10 ' as unsigned integer);
- SELECT 1;
- END|
+ SELECT CAST('3 ' as unsigned integer);
+ SELECT 1; # does not clear the warning
+ END| # 1 warning is passed to the caller
CREATE PROCEDURE p4()
BEGIN
- SELECT CAST('10 ' as unsigned integer);
+ SELECT CAST('4 ' as unsigned integer);
+ INSERT INTO t1 VALUES(1); # Clears the warning
+ END| # No warnings to pass
+
+CREATE PROCEDURE p5()
+ BEGIN
+ SELECT CAST('5 ' as unsigned integer);
CALL p2();
END|
-CREATE PROCEDURE p5()
+CREATE PROCEDURE p6()
BEGIN
- SELECT CAST('10 ' as unsigned integer);
+ SELECT CAST('6 ' as unsigned integer);
SHOW WARNINGS;
END|
-CREATE PROCEDURE P6()
+CREATE PROCEDURE p7()
BEGIN
DECLARE c INT DEFAULT 0;
- DECLARE CONTINUE HANDLER FOR SQLWARNING SET c = c + 1;
- CALL p5();
+ DECLARE CONTINUE HANDLER FOR SQLWARNING
+ BEGIN
+ SET c = c + 1;
+ SELECT 'Warning caught!' AS Msg;
+ END;
+ CALL p6();
SELECT c;
END|
delimiter ;|
+--echo
CALL p1();
-CALL p6();
+
+--echo
+CALL p7();
+
+--echo
DROP PROCEDURE p1;
DROP PROCEDURE p2;
@@ -2641,6 +2667,9 @@ DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP PROCEDURE p5;
DROP PROCEDURE p6;
+DROP PROCEDURE p7;
+
+DROP TABLE t1;
--echo
--echo # - Case 3: check that "Exception trumps No Data".
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-05-19 10:12:31 +0000
+++ b/sql/sp_head.cc 2011-05-19 12:07:04 +0000
@@ -1141,17 +1141,42 @@ void sp_head::recursion_level_error(THD
static void
find_handler_after_execution(THD *thd, sp_rcontext *ctx)
{
+ Diagnostics_area *da= thd->get_stmt_da();
+ Warning_info *wi= thd->get_warning_info();
+
if (thd->is_error())
{
- ctx->find_handler(thd,
- thd->get_stmt_da()->sql_errno(),
- thd->get_stmt_da()->get_sqlstate(),
- MYSQL_ERROR::WARN_LEVEL_ERROR,
- thd->get_stmt_da()->message());
+ if (!ctx->find_handler(thd,
+ da->sql_errno(),
+ da->get_sqlstate(),
+ MYSQL_ERROR::WARN_LEVEL_ERROR,
+ da->message()))
+ {
+ return;
+ }
+
+ MYSQL_ERROR *err_condition= wi->get_error_condition();
+
+ if (!err_condition)
+ return;
+
+ List_iterator<MYSQL_ERROR> it(wi->warn_list());
+ MYSQL_ERROR *err;
+
+ while ((err= it++))
+ {
+ if (err != err_condition)
+ continue;
+
+ wi->remove_warning(err);
+ it.remove();
+
+ break;
+ }
}
- else if (thd->get_warning_info()->statement_warn_count())
+ else if (wi->statement_warn_count())
{
- List_iterator<MYSQL_ERROR> it(thd->get_warning_info()->warn_list());
+ List_iterator<MYSQL_ERROR> it(wi->warn_list());
MYSQL_ERROR *err;
while ((err= it++))
{
@@ -1165,6 +1190,8 @@ find_handler_after_execution(THD *thd, s
err->get_level(),
err->get_message_text()))
{
+ wi->remove_warning(err);
+ it.remove();
break;
}
}
=== modified file 'sql/sql_error.cc'
--- a/sql/sql_error.cc 2011-05-19 11:53:50 +0000
+++ b/sql/sql_error.cc 2011-05-19 12:07:04 +0000
@@ -560,6 +560,23 @@ void Warning_info::merge_with_routine_in
}
}
+void Warning_info::reserve_space(THD *thd, uint count)
+{
+ /* Make room for count conditions */
+ while ((m_warn_list.elements > 0) &&
+ ((m_warn_list.elements + count) > thd->variables.max_error_count))
+ m_warn_list.pop();
+}
+
+void Warning_info::remove_warning(const MYSQL_ERROR *sql_condition)
+{
+ m_warn_count[sql_condition->get_level()]--;
+ m_statement_warn_count--;
+
+ if (sql_condition == m_error_condition)
+ m_error_condition= NULL;
+}
+
/**
Add a warning to the list of warnings. Increment the respective
counters.
=== modified file 'sql/sql_error.h'
--- a/sql/sql_error.h 2011-05-19 11:53:50 +0000
+++ b/sql/sql_error.h 2011-05-19 12:07:04 +0000
@@ -461,6 +461,8 @@ public:
ulong statement_warn_count() const { return m_statement_warn_count; }
+ void reserve_space(THD *thd, uint count);
+
/** Add a new condition to the current list. */
MYSQL_ERROR *push_warning(THD *thd,
uint sql_errno, const char* sqlstate,
@@ -494,17 +496,22 @@ public:
MYSQL_ERROR *get_error_condition()
{ return m_error_condition; }
+private:
void set_error_condition(MYSQL_ERROR *error_condition)
{ m_error_condition= error_condition; }
void clear_error_condition()
{ m_error_condition= NULL; }
+public:
+ void remove_warning(const MYSQL_ERROR *sql_condition);
+
private:
/** Read only status. */
bool m_read_only;
friend class Resignal_statement;
+ friend class Diagnostics_area;
};
extern char *err_conv(char *buff, uint to_length, const char *from,
=== modified file 'sql/sql_signal.cc'
--- a/sql/sql_signal.cc 2011-05-19 10:10:49 +0000
+++ b/sql/sql_signal.cc 2011-05-19 12:07:04 +0000
@@ -478,12 +478,13 @@ bool Signal_statement::execute(THD *thd)
bool Resignal_statement::execute(THD *thd)
{
+ Warning_info *wi= thd->get_warning_info();
MYSQL_ERROR *signaled;
int result= TRUE;
DBUG_ENTER("Resignal_statement::execute");
- thd->get_warning_info()->m_warn_id= thd->query_id;
+ wi->m_warn_id= thd->query_id;
if (! thd->spcont || ! (signaled= thd->spcont->raised_condition()))
{
@@ -491,14 +492,24 @@ bool Resignal_statement::execute(THD *th
DBUG_RETURN(result);
}
- if (m_cond == NULL)
+ if (m_cond)
{
- /* RESIGNAL without signal_value */
- result= raise_condition(thd, signaled);
- DBUG_RETURN(result);
+ MYSQL_ERROR *cond;
+
+ query_cache_abort(&thd->query_cache_tls);
+
+ /* Make room for 2 conditions. */
+ wi->reserve_space(thd, 2);
+
+ cond= wi->push_warning(thd,
+ signaled->get_sql_errno(),
+ signaled->get_sqlstate(),
+ signaled->get_level(),
+ signaled->get_message_text());
+ if (cond)
+ cond->copy_opt_attributes(signaled);
}
- /* RESIGNAL with signal_value */
result= raise_condition(thd, signaled);
DBUG_RETURN(result);
Attachment: [text/bzr-bundle] bzr/alexander.nozdrin@oracle.com-20110519120704-v06l5adezalhvats.bundle
| Thread |
|---|
| • bzr commit into mysql-5.5 branch (alexander.nozdrin:3391) Bug#11763162 | Alexander Nozdrin | 19 May |