diff options
author | unknown <pem@mysql.comhem.se> | 2005-03-30 17:43:52 +0200 |
---|---|---|
committer | unknown <pem@mysql.comhem.se> | 2005-03-30 17:43:52 +0200 |
commit | 66b71ca3785fe9f3dd93c2debeafb5cb19e34bdf (patch) | |
tree | 60e2dfa1271b73f59fda7362c9be680275cbe247 | |
parent | 3a44dcd1a3b8b9e23200c3527bb43850ffdb8ece (diff) | |
download | mariadb-git-66b71ca3785fe9f3dd93c2debeafb5cb19e34bdf.tar.gz |
Fixed BUG#6600: Stored procedure crash after repeated calls with check table.
Sedond attempt: Simply disallow CHECK in SPs, since it can't work.
mysql-test/r/sp-error.result:
New test cast for BUG#6600
mysql-test/r/sp.result:
Removed old test case for BUG#6600
mysql-test/t/sp-error.test:
New test cast for BUG#6600
mysql-test/t/sp.test:
Removed old test case for BUG#6600
sql/share/errmsg.txt:
Made the SP bad statement error message more general.
sql/sp_head.cc:
CHECK is not possible in stored procedures.
sql/sql_parse.cc:
Undid attempt to fix CHECK in stored procedures, it didn't work.
sql/sql_yacc.yy:
CHECK is not possible in stored procedures.
(And updated error messages for LOCK/UNLOCK.)
-rw-r--r-- | mysql-test/r/sp-error.result | 9 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 19 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 17 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 22 | ||||
-rw-r--r-- | sql/share/errmsg.txt | 2 | ||||
-rw-r--r-- | sql/sp_head.cc | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 16 |
8 files changed, 38 insertions, 50 deletions
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 1182c3d3569..c979ee34df0 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -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| diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index b02714bc1af..93884bf4cf4 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -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; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 53783e7c9bf..621700b732a 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -681,6 +681,23 @@ 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 # #--disable_warnings diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 5c2e02045c5..b8eb371931f 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -3399,28 +3399,6 @@ 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 # #--disable_warnings diff --git a/sql/share/errmsg.txt b/sql/share/errmsg.txt index 7249605f10c..5f84395e201 100644 --- a/sql/share/errmsg.txt +++ b/sql/share/errmsg.txt @@ -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 diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 037ef0b70ca..89c4b2dbaac 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -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: diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ccd3277d785..727da7a9a4c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -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: diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8141de31275..34a5d731fa4 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -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; |