1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Fixed BUG#4904: Stored procedure crash if continue handler for HY000 errors.

The description is not entirerly correct. The issue was follow-up errors
  where the first error is not caught - in which case it's often a system
  error with errcode < 1000 (which are mapped by default to 'HY000'). In this
  case the error state is different from what was assumed in the execution
  loop.


mysql-test/r/sp.result:
  New test case for BUG#4902.
mysql-test/t/sp.test:
  New test case for BUG#4902.
sql/sp_head.cc:
  Don't test the net.report_error flag in the execution loop. (Don't know
  why this was done in the first place, as it seems to serve no purpose.)
This commit is contained in:
unknown
2004-08-06 15:21:28 +02:00
parent 177ef90b57
commit ba7c743983
3 changed files with 28 additions and 3 deletions

View File

@@ -2237,6 +2237,14 @@ Tables_in_test (foo) table_type
Variable_name Value Variable_name Value
Level Code Message Level Code Message
drop procedure bug4902| drop procedure bug4902|
drop table if exists t3|
create procedure bug4904()
begin
declare continue handler for sqlstate 'HY000' begin end;
create table t2 as select * from t;
end|
call bug4904()|
drop procedure bug4904|
drop table if exists fac| drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)| create table fac (n int unsigned not null primary key, f bigint unsigned)|
create procedure ifac(n int unsigned) create procedure ifac(n int unsigned)

View File

@@ -1717,6 +1717,24 @@ call bug4902()|
drop procedure bug4902| drop procedure bug4902|
#
# BUG#4904
#
--disable_warnings
drop table if exists t3|
--enable_warnings
create procedure bug4904()
begin
declare continue handler for sqlstate 'HY000' begin end;
create table t2 as select * from t;
end|
call bug4904()|
drop procedure bug4904|
# #
# Some "real" examples # Some "real" examples

View File

@@ -486,8 +486,7 @@ sp_head::execute(THD *thd)
continue; continue;
} }
} }
} while (ret == 0 && !thd->killed && !thd->query_error && } while (ret == 0 && !thd->killed && !thd->query_error);
!thd->net.report_error);
if (thd->current_arena) if (thd->current_arena)
cleanup_items(thd->current_arena->free_list); cleanup_items(thd->current_arena->free_list);
@@ -497,7 +496,7 @@ sp_head::execute(THD *thd)
DBUG_PRINT("info", ("ret=%d killed=%d query_error=%d", DBUG_PRINT("info", ("ret=%d killed=%d query_error=%d",
ret, thd->killed, thd->query_error)); ret, thd->killed, thd->query_error));
if (thd->killed || thd->query_error || thd->net.report_error) if (thd->killed || thd->query_error)
ret= -1; ret= -1;
/* If the DB has changed, the pointer has changed too, but the /* If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed */ original thd->db will then have been freed */