List:Internals« Previous MessageNext Message »
From:Alexander Nozdrin Date:December 7 2005 1:45pm
Subject:bk commit into 5.0 tree (anozdrin:1.1982) BUG#13012
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of alik. When alik does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1982 05/12/07 15:45:13 anozdrin@stripped +3 -0
  Fix for Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
  The following statements are forbidden for use in stored procedures/functions:
    - REPAIR TABLE
    - BACKUP TABLE
    - RESTORE TABLE

  sql/sql_yacc.yy
    1.444 05/12/07 15:45:09 anozdrin@stripped +19 -2
    Forbid the following statements from use in stored procedures/functions:
      - REPAIR TABLE
      - BACKUP TABLE
      - RESTORE TABLE

  mysql-test/t/sp-error.test
    1.98 05/12/07 15:45:08 anozdrin@stripped +40 -0
    Test case for Bug#13012 added.

  mysql-test/r/sp-error.result
    1.95 05/12/07 15:45:08 anozdrin@stripped +26 -0
    Results for the test case for Bug#13012 added.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	anozdrin
# Host:	booka.home
# Root:	/home/alik/MySQL/devel/5.0-bug13012

--- 1.443/sql/sql_yacc.yy	2005-12-06 15:20:53 +03:00
+++ 1.444/sql/sql_yacc.yy	2005-12-07 15:45:09 +03:00
@@ -3677,7 +3677,13 @@
 restore:
 	RESTORE_SYM table_or_tables
 	{
-	   Lex->sql_command = SQLCOM_RESTORE_TABLE;
+	   LEX *lex=Lex;
+	   if (lex->sphead)
+	   {
+	     my_error(ER_SP_BADSTATEMENT, MYF(0), "RESTORE TABLE");
+	     YYABORT;
+	   }
+	   lex->sql_command = SQLCOM_RESTORE_TABLE;
 	}
 	table_list FROM TEXT_STRING_sys
         {
@@ -3687,7 +3693,13 @@
 backup:
 	BACKUP_SYM table_or_tables
 	{
-	   Lex->sql_command = SQLCOM_BACKUP_TABLE;
+	   LEX *lex=Lex;
+	   if (lex->sphead)
+	   {
+	     my_error(ER_SP_BADSTATEMENT, MYF(0), "BACKUP TABLE");
+	     YYABORT;
+	   }
+	   lex->sql_command = SQLCOM_BACKUP_TABLE;
 	}
 	table_list TO_SYM TEXT_STRING_sys
         {
@@ -3714,6 +3726,11 @@
 	REPAIR opt_no_write_to_binlog table_or_tables
 	{
 	   LEX *lex=Lex;
+	   if (lex->sphead)
+	   {
+	     my_error(ER_SP_BADSTATEMENT, MYF(0), "REPAIR TABLE");
+	     YYABORT;
+	   }
 	   lex->sql_command = SQLCOM_REPAIR;
            lex->no_write_to_binlog= $2;
 	   lex->check_opt.init();

--- 1.94/mysql-test/r/sp-error.result	2005-12-06 15:20:52 +03:00
+++ 1.95/mysql-test/r/sp-error.result	2005-12-07 15:45:08 +03:00
@@ -1055,3 +1055,29 @@
 mysqltest2	p1	PROCEDURE	root@localhost	0000-00-00 00:00:00	0000-00-00 00:00:00	DEFINER	
 drop database mysqltest2;
 use test;
+DROP FUNCTION IF EXISTS bug13012|
+DROP PROCEDURE IF EXISTS bug13012|
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+REPAIR TABLE t1;
+RETURN 1;
+END|
+ERROR 0A000: REPAIR TABLE is not allowed in stored procedures
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+BACKUP TABLE t1 TO '../tmp';
+RETURN 1;
+END|
+ERROR 0A000: BACKUP TABLE is not allowed in stored procedures
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+RESTORE TABLE t1 FROM '../tmp';
+RETURN 1;
+END|
+ERROR 0A000: RESTORE TABLE is not allowed in stored procedures
+CREATE PROCEDURE bug13012()
+BEGIN
+RESTORE TABLE t1 FROM '../tmp';
+RETURN 1;
+END|
+ERROR 0A000: RESTORE TABLE is not allowed in stored procedures

--- 1.97/mysql-test/t/sp-error.test	2005-11-23 02:12:33 +03:00
+++ 1.98/mysql-test/t/sp-error.test	2005-12-07 15:45:08 +03:00
@@ -1518,6 +1518,46 @@
 drop database mysqltest2;
 use test;
 
+#
+# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
+#
+delimiter |;
+
+--disable_warnings
+DROP FUNCTION IF EXISTS bug13012|
+DROP PROCEDURE IF EXISTS bug13012|
+--enable_warnings
+
+--error ER_SP_BADSTATEMENT
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+  REPAIR TABLE t1;
+  RETURN 1;
+END|
+
+--error ER_SP_BADSTATEMENT
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+  BACKUP TABLE t1 TO '../tmp';
+  RETURN 1;
+END|
+
+--error ER_SP_BADSTATEMENT
+CREATE FUNCTION bug13012() RETURNS INT
+BEGIN
+  RESTORE TABLE t1 FROM '../tmp';
+  RETURN 1;
+END|
+
+--error ER_SP_BADSTATEMENT
+CREATE PROCEDURE bug13012()
+BEGIN
+  RESTORE TABLE t1 FROM '../tmp';
+  RETURN 1;
+END|
+
+delimiter ;|
+
 
 # BUG#NNNN: New bug synopsis
 #
Thread
bk commit into 5.0 tree (anozdrin:1.1982) BUG#13012Alexander Nozdrin7 Dec