Commit 6c621bbd authored by unknown's avatar unknown
Browse files

Fixed BUG#6600: Stored procedure crash after repeated calls with check table


mysql-test/r/sp.result:
  New test case for BUG#6600.
mysql-test/t/sp.test:
  New test case for BUG#6600.
sql/sp_head.cc:
  Added yet another multiple result set statement to the list.
sql/sql_parse.cc:
  Have to invalidate SP caches in CHECK TABLE, or it will produce very
  strange results when called in SPs.
parent 7e79e705
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -2777,4 +2777,23 @@ a
3.2000
drop procedure bug8937|
delete from t1|
drop procedure if exists bug6600|
drop table if exists t3|
drop view if exists v1|
create table t3 (s1 decimal(31,30))|
create view v1 as select * from t3|
create procedure bug6600()
check table v1|
call bug6600()|
Table	Op	Msg_type	Msg_text
test.v1	check	status	OK
call bug6600()|
Table	Op	Msg_type	Msg_text
test.v1	check	status	OK
call bug6600()|
Table	Op	Msg_type	Msg_text
test.v1	check	status	OK
drop procedure bug6600|
drop view v1|
drop table t3|
drop table t1,t2;
+22 −0
Original line number Diff line number Diff line
@@ -3398,6 +3398,28 @@ drop procedure bug8937|
delete from t1|


#
# BUG#6600: Stored procedure crash after repeated calls with check table
#
--disable_warnings
drop procedure if exists bug6600|
drop table if exists t3|
drop view if exists v1|
--enable_warnings
create table t3 (s1 decimal(31,30))|
create view v1 as select * from t3|

create procedure bug6600()
  check table v1|

call bug6600()|
call bug6600()|
call bug6600()|
drop procedure bug6600|
drop view v1|
drop table t3|


#
# BUG#NNNN: New bug synopsis
#
+1 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ sp_multi_results_command(enum enum_sql_command cmd)
{
  switch (cmd) {
  case SQLCOM_ANALYZE:
  case SQLCOM_CHECK:
  case SQLCOM_CHECKSUM:
  case SQLCOM_HA_READ:
  case SQLCOM_SHOW_BINLOGS:
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@

#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"

#ifdef HAVE_OPENSSL
/*
@@ -3045,6 +3046,7 @@ mysql_execute_command(THD *thd)
      goto error; /* purecov: inspected */
    thd->slow_command=TRUE;
    res = mysql_check_table(thd, first_table, &lex->check_opt);
    sp_cache_invalidate();
    break;
  }
  case SQLCOM_ANALYZE: