summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-error.test
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2005-09-06 21:43:06 +0400
committerunknown <anozdrin@mysql.com>2005-09-06 21:43:06 +0400
commitb89205880f6ce80ccba6e5c43be7af77828b2342 (patch)
treedf64725c04d5d1a1bb409b6ae11e013c340a1d48 /mysql-test/t/sp-error.test
parent9e7a1bb2b019a1a8048bc9ef8cdf00fcc255d812 (diff)
downloadmariadb-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 'mysql-test/t/sp-error.test')
-rw-r--r--mysql-test/t/sp-error.test17
1 files changed, 15 insertions, 2 deletions
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index e289748ba2f..abb927ab3b8 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1085,6 +1085,21 @@ drop function bug11834_1;
execute stmt;
deallocate prepare stmt;
drop function bug11834_2;
+
+#
+# Bug#12953 "Stored procedures: crash if OPTIMIZE TABLE in function"
+#
+delimiter |;
+--disable_warnings
+DROP FUNCTION IF EXISTS bug12953|
+--enable_warnings
+--error ER_SP_BADSTATEMENT
+CREATE FUNCTION bug12953() RETURNS INT
+BEGIN
+ OPTIMIZE TABLE t1;
+ RETURN 1;
+END|
+
#
# BUG#NNNN: New bug synopsis
#
@@ -1092,5 +1107,3 @@ drop function bug11834_2;
#drop procedure if exists bugNNNN|
#--enable_warnings
#create procedure bugNNNN...
-
-