Commit b18ca48c authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Additional fix for BUG#5907: Traditional mode: invalid value can be inserted via a stored procedure

... make the handler catch too.
parent 6c8624f6
...@@ -1180,7 +1180,8 @@ Note 1305 PROCEDURE t1 does not exist ...@@ -1180,7 +1180,8 @@ Note 1305 PROCEDURE t1 does not exist
create procedure t1 () begin declare exit handler for sqlexception create procedure t1 () begin declare exit handler for sqlexception
select'a'; insert into t1 values (200); end;| select'a'; insert into t1 values (200); end;|
call t1(); call t1();
ERROR 22003: Out of range value adjusted for column 'col1' at row 1 a
a
select * from t1; select * from t1;
col1 col1
drop procedure t1; drop procedure t1;
......
...@@ -1040,7 +1040,6 @@ delimiter |; ...@@ -1040,7 +1040,6 @@ delimiter |;
create procedure t1 () begin declare exit handler for sqlexception create procedure t1 () begin declare exit handler for sqlexception
select'a'; insert into t1 values (200); end;| select'a'; insert into t1 values (200); end;|
delimiter ;| delimiter ;|
--error 1264
call t1(); call t1();
select * from t1; select * from t1;
drop procedure t1; drop procedure t1;
......
...@@ -561,7 +561,10 @@ sp_head::execute(THD *thd) ...@@ -561,7 +561,10 @@ sp_head::execute(THD *thd)
// Check if an exception has occurred and a handler has been found // Check if an exception has occurred and a handler has been found
// Note: We havo to check even if ret==0, since warnings (and some // Note: We havo to check even if ret==0, since warnings (and some
// errors don't return a non-zero value. // errors don't return a non-zero value.
if (!thd->killed && ctx) // We also have to check even if thd->killed != 0, since some
// errors return with this even when a handler has been found
// (e.g. "bad data").
if (ctx)
{ {
uint hf; uint hf;
...@@ -579,6 +582,7 @@ sp_head::execute(THD *thd) ...@@ -579,6 +582,7 @@ sp_head::execute(THD *thd)
ctx->clear_handler(); ctx->clear_handler();
ctx->in_handler= TRUE; ctx->in_handler= TRUE;
thd->clear_error(); thd->clear_error();
thd->killed= THD::NOT_KILLED;
continue; continue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment