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

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

  Sedond attempt: Simply disallow CHECK in SPs, since it can't work.
parent 8098ef79
......@@ -494,4 +494,13 @@ declare continue handler for sqlstate '42x00' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '42x00'
create procedure bug6600()
check table t1|
ERROR 0A000: CHECK is not allowed in stored procedures
create procedure bug6600()
lock table t1 read|
ERROR 0A000: LOCK is not allowed in stored procedures
create procedure bug6600()
unlock table t1|
ERROR 0A000: UNLOCK is not allowed in stored procedures
drop table t1|
......@@ -2779,23 +2779,4 @@ 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;
......@@ -680,6 +680,23 @@ begin
end|
#
# BUG#6600: Stored procedure crash after repeated calls with check table
#
--error ER_SP_BADSTATEMENT
create procedure bug6600()
check table t1|
# Check these two as well, while we're at it. (Although it isn't really
# related to the bug report, but to the fix.)
--error ER_SP_BADSTATEMENT
create procedure bug6600()
lock table t1 read|
--error ER_SP_BADSTATEMENT
create procedure bug6600()
unlock table t1|
#
# BUG#NNNN: New bug synopsis
#
......
......@@ -3398,28 +3398,6 @@ 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
#
......
......@@ -5094,7 +5094,7 @@ ER_SP_BADSELECT 0A000
ER_SP_BADRETURN 42000
eng "RETURN is only allowed in a FUNCTION"
ER_SP_BADSTATEMENT 0A000
eng "LOCK and UNLOCK tables are not allowed in stored procedures"
eng "%s is not allowed in stored procedures"
ER_UPDATE_LOG_DEPRECATED_IGNORED 42000
eng "The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored"
ER_UPDATE_LOG_DEPRECATED_TRANSLATED 42000
......
......@@ -58,7 +58,6 @@ 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:
......
......@@ -27,7 +27,6 @@
#include "sp_head.h"
#include "sp.h"
#include "sp_cache.h"
#ifdef HAVE_OPENSSL
/*
......@@ -3046,7 +3045,6 @@ unsent_create_error:
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:
......
......@@ -3670,9 +3670,15 @@ analyze:
check:
CHECK_SYM table_or_tables
{
LEX *lex=Lex;
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
LEX *lex=Lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "CHECK");
YYABORT;
}
lex->sql_command = SQLCOM_CHECK;
lex->check_opt.init();
}
table_list opt_mi_check_type
{}
......@@ -7719,7 +7725,7 @@ lock:
if (lex->sphead)
{
my_message(ER_SP_BADSTATEMENT, ER(ER_SP_BADSTATEMENT), MYF(0));
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOCK");
YYABORT;
}
lex->sql_command= SQLCOM_LOCK_TABLES;
......@@ -7758,7 +7764,7 @@ unlock:
if (lex->sphead)
{
my_message(ER_SP_BADSTATEMENT, ER(ER_SP_BADSTATEMENT), MYF(0));
my_error(ER_SP_BADSTATEMENT, MYF(0), "UNLOCK");
YYABORT;
}
lex->sql_command= SQLCOM_UNLOCK_TABLES;
......
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