From f3281e7b3381841cdab52d5f53c0ff813754e108 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 5 Apr 2005 15:49:10 +0200 Subject: [PATCH] Additional fix for BUG#5907: Traditional mode: invalid value can be inserted via a stored procedure ... make the handler catch too. mysql-test/r/strict.result: Updated corrected result for BUG#5907. mysql-test/t/strict.test: Corrected test for BUG#5907. sql/sp_head.cc: Make handlers catch certain bad data exceptions in strict mode too. --- mysql-test/r/strict.result | 3 ++- mysql-test/t/strict.test | 1 - sql/sp_head.cc | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result index c4d860c5c77..99ea0d577da 100644 --- a/mysql-test/r/strict.result +++ b/mysql-test/r/strict.result @@ -1180,7 +1180,8 @@ Note 1305 PROCEDURE t1 does not exist create procedure t1 () begin declare exit handler for sqlexception select'a'; insert into t1 values (200); end;| call t1(); -ERROR 22003: Out of range value adjusted for column 'col1' at row 1 +a +a select * from t1; col1 drop procedure t1; diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test index b5d234b7bea..6b7ce1a8f9e 100644 --- a/mysql-test/t/strict.test +++ b/mysql-test/t/strict.test @@ -1040,7 +1040,6 @@ delimiter |; create procedure t1 () begin declare exit handler for sqlexception select'a'; insert into t1 values (200); end;| delimiter ;| ---error 1264 call t1(); select * from t1; drop procedure t1; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 89c4b2dbaac..63f67959f33 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -561,7 +561,10 @@ sp_head::execute(THD *thd) // 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 // 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; @@ -579,6 +582,7 @@ sp_head::execute(THD *thd) ctx->clear_handler(); ctx->in_handler= TRUE; thd->clear_error(); + thd->killed= THD::NOT_KILLED; continue; } }