diff options
author | unknown <anozdrin@mysql.com> | 2005-09-06 21:43:06 +0400 |
---|---|---|
committer | unknown <anozdrin@mysql.com> | 2005-09-06 21:43:06 +0400 |
commit | b89205880f6ce80ccba6e5c43be7af77828b2342 (patch) | |
tree | df64725c04d5d1a1bb409b6ae11e013c340a1d48 /sql/sql_yacc.yy | |
parent | 9e7a1bb2b019a1a8048bc9ef8cdf00fcc255d812 (diff) | |
download | mariadb-git-b89205880f6ce80ccba6e5c43be7af77828b2342.tar.gz |
Fix for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function"
OPTIMIZE TABLE statement is forbidden from usage in stored procedures/functions.
NOTE: OPTIMIZE TABLE statement can be useful in stored procedures. The idea is
that the user/administrator can create a stored procedure for admin
tasks (optimizing, backing up, etc). This procedure can be scheduled to run
automatically (by mean of internal cron (WL#1034)). So, once we can make this
statement work, it is worth doing it.
mysql-test/r/sp-error.result:
Results for the test case for Bug#12953 added.
mysql-test/t/sp-error.test:
Test case for Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function" added.
sql/sql_yacc.yy:
Forbid "OPTIMIZE TABLE" statement from use in stored procedures/functions.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c9b41cb495b..cc286e4ff45 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3826,6 +3826,11 @@ optimize: OPTIMIZE opt_no_write_to_binlog table_or_tables { LEX *lex=Lex; + if (lex->sphead) + { + my_error(ER_SP_BADSTATEMENT, MYF(0), "OPTIMIZE TABLE"); + YYABORT; + } lex->sql_command = SQLCOM_OPTIMIZE; lex->no_write_to_binlog= $2; lex->check_opt.init(); |