List:Commits« Previous MessageNext Message »
From:kpettersson Date:December 1 2006 5:23pm
Subject:bk commit into 5.1 tree (thek:1.2400)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of thek. When thek 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@stripped, 2006-12-01 17:23:12+01:00, thek@stripped +5 -0
  Merge kpdesk.mysql.com:/home/thek/dev/bug22043/my50-bug22043
  into  kpdesk.mysql.com:/home/thek/dev/bug22043/my51-bug22043
  MERGE: 1.1810.2325.3

  mysql-test/r/information_schema.result@stripped, 2006-12-01 17:21:07+01:00,
thek@stripped +0 -0
    Auto merged
    MERGE: 1.87.1.29

  mysql-test/r/rpl_sp.result@stripped, 2006-12-01 17:22:12+01:00, thek@stripped +0 -9
    null merge
    MERGE: 1.13.3.2

  mysql-test/t/information_schema.test@stripped, 2006-12-01 17:21:07+01:00,
thek@stripped +0 -0
    Auto merged
    MERGE: 1.65.1.22

  mysql-test/t/rpl_sp.test@stripped, 2006-12-01 17:23:04+01:00, thek@stripped +0 -2
    null merge
    MERGE: 1.9.3.2

  sql/sql_parse.cc@stripped, 2006-12-01 17:21:07+01:00, thek@stripped +0 -1
    Auto merged
    MERGE: 1.426.120.2

# 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:	thek
# Host:	kpdesk.mysql.com
# Root:	/home/thek/dev/bug22043/my51-bug22043/RESYNC

--- 1.598/sql/sql_parse.cc	2006-12-01 17:23:19 +01:00
+++ 1.599/sql/sql_parse.cc	2006-12-01 17:23:19 +01:00
@@ -4383,11 +4383,10 @@ end_with_restore_list:
   {
     uint namelen;
     char *name;
-    int result;
+    int result= SP_INTERNAL_ERROR;
 
     DBUG_ASSERT(lex->sphead != 0);
     DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */
-
     /*
       Verify that the database name is allowed, optionally
       lowercase it.
@@ -4395,37 +4394,26 @@ end_with_restore_list:
     if (check_db_name(lex->sphead->m_db.str))
     {
       my_error(ER_WRONG_DB_NAME, MYF(0), lex->sphead->m_db.str);
-      delete lex->sphead;
-      lex->sphead= 0;
-      goto error;
+      goto create_sp_error;
     }
 
     /*
-      Check that a database with this name
-      exists.
+      Check that a database directory with this name
+      exists. Design note: This won't work on virtual databases
+      like information_schema.
     */
     if (check_db_dir_existence(lex->sphead->m_db.str))
     {
       my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
-      delete lex->sphead;
-      lex->sphead= 0;
-      goto error;
+      goto create_sp_error;
     }
 
     if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, 0, 0, 0,
                      is_schema_db(lex->sphead->m_db.str)))
-    {
-      delete lex->sphead;
-      lex->sphead= 0;
-      goto error;
-    }
+      goto create_sp_error;
 
-    if (end_active_trans(thd)) 
-    {
-      delete lex->sphead;
-      lex->sphead= 0;
-      goto error;
-    }
+    if (end_active_trans(thd))
+      goto create_sp_error;
 
     name= lex->sphead->name(&namelen);
 #ifdef HAVE_DLOPEN
@@ -4435,10 +4423,8 @@ end_with_restore_list:
 
       if (udf)
       {
-	my_error(ER_UDF_EXISTS, MYF(0), name);
-	delete lex->sphead;
-	lex->sphead= 0;
-	goto error;
+        my_error(ER_UDF_EXISTS, MYF(0), name);
+        goto create_sp_error;
       }
     }
 #endif
@@ -4446,7 +4432,7 @@ end_with_restore_list:
     /*
       If the definer is not specified, this means that CREATE-statement missed
       DEFINER-clause. DEFINER-clause can be missed in two cases:
-      
+
         - The user submitted a statement w/o the clause. This is a normal
           case, we should assign CURRENT_USER as definer.
 
@@ -4455,7 +4441,7 @@ end_with_restore_list:
           CURRENT_USER as definer here, but also we should mark this routine
           as NON-SUID. This is essential for the sake of backward
           compatibility.
-          
+
           The problem is the slave thread is running under "special" user (@),
           that actually does not exist. In the older versions we do not fail
           execution of a stored routine if its definer does not exist and
@@ -4480,13 +4466,9 @@ end_with_restore_list:
       if (ps_arena)
         thd->restore_active_arena(ps_arena, &original_arena);
 
+      /* Error has been already reported. */
       if (res)
-      {
-        /* Error has been already reported. */
-        delete lex->sphead;
-        lex->sphead= 0;
-        goto error;
-      }
+        goto create_sp_error;
 
       if (thd->slave_thread)
         lex->sphead->m_chistics->suid= SP_IS_NOT_SUID;
@@ -4497,7 +4479,7 @@ end_with_restore_list:
       that the current user has SUPER privilege (in order to create a stored
       routine under another user one must have SUPER privilege).
     */
-    
+
     else if (strcmp(lex->definer->user.str, thd->security_ctx->priv_user) ||
         my_strcasecmp(system_charset_info,
                       lex->definer->host.str,
@@ -4506,9 +4488,7 @@ end_with_restore_list:
       if (check_global_access(thd, SUPER_ACL))
       {
         my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "SUPER");
-        delete lex->sphead;
-        lex->sphead= 0;
-        goto error;
+        goto create_sp_error;
       }
     }
 
@@ -4528,54 +4508,51 @@ end_with_restore_list:
 #endif /* NO_EMBEDDED_ACCESS_CHECKS */
 
     res= (result= lex->sphead->create(thd));
-    if (result == SP_OK)
-    {
+    switch (result) {
+    case SP_OK:
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
       /* only add privileges if really neccessary */
       if (sp_automatic_privileges && !opt_noacl &&
           check_routine_access(thd, DEFAULT_CREATE_PROC_ACLS,
-      			       lex->sphead->m_db.str, name,
+                               lex->sphead->m_db.str, name,
                                lex->sql_command == SQLCOM_CREATE_PROCEDURE, 1))
       {
         if (sp_grant_privileges(thd, lex->sphead->m_db.str, name,
                                 lex->sql_command == SQLCOM_CREATE_PROCEDURE))
-          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 
-	  	       ER_PROC_AUTO_GRANT_FAIL,
-		       ER(ER_PROC_AUTO_GRANT_FAIL));
+          push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                       ER_PROC_AUTO_GRANT_FAIL,
+                       ER(ER_PROC_AUTO_GRANT_FAIL));
         close_thread_tables(thd);
       }
 #endif
-      lex->unit.cleanup();
-      delete lex->sphead;
-      lex->sphead= 0;
-      send_ok(thd);
-    }
-    else
-    {
-      switch (result) {
-      case SP_WRITE_ROW_FAILED:
-	my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
-	break;
-      case SP_NO_DB_ERROR:
-	my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str);
-	break;
-      case SP_BAD_IDENTIFIER:
-	my_error(ER_TOO_LONG_IDENT, MYF(0), name);
-	break;
-      case SP_BODY_TOO_LONG:
-	my_error(ER_TOO_LONG_BODY, MYF(0), name);
-	break;
-      default:
-	my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
-	break;
-      }
-      lex->unit.cleanup();
-      delete lex->sphead;
-      lex->sphead= 0;
-      goto error;
-    }
     break;
-  }
+    case SP_WRITE_ROW_FAILED:
+      my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name);
+    break;
+    case SP_BAD_IDENTIFIER:
+      my_error(ER_TOO_LONG_IDENT, MYF(0), name);
+    break;
+    case SP_BODY_TOO_LONG:
+      my_error(ER_TOO_LONG_BODY, MYF(0), name);
+    break;
+    default:
+      my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name);
+    break;
+    } /* end switch */
+
+    /*
+      Capture all errors within this CASE and
+      clean up the environment.
+    */
+create_sp_error:
+    lex->unit.cleanup();
+    delete lex->sphead;
+    lex->sphead= 0;
+    if (result != SP_OK )
+      goto error;
+    send_ok(thd);
+    break; /* break super switch */
+  } /* end case group bracket */
   case SQLCOM_CALL:
     {
       sp_head *sp;

--- 1.137/mysql-test/r/information_schema.result	2006-12-01 17:23:19 +01:00
+++ 1.138/mysql-test/r/information_schema.result	2006-12-01 17:23:19 +01:00
@@ -1080,7 +1080,7 @@ CREATE PROCEDURE p1 ()
 BEGIN
 SELECT 'foo' FROM DUAL;
 END |
-ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+ERROR 42000: Unknown database 'information_schema'
 select  ROUTINE_NAME from routines;
 ROUTINE_NAME
 grant all on information_schema.* to 'user1'@'localhost';

--- 1.87/mysql-test/t/information_schema.test	2006-12-01 17:23:19 +01:00
+++ 1.88/mysql-test/t/information_schema.test	2006-12-01 17:23:19 +01:00
@@ -721,7 +721,7 @@ create temporary table schemata(f1 char(
 # Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA
 #
 delimiter |;
---error 1044
+--error ER_BAD_DB_ERROR
 CREATE PROCEDURE p1 ()
 BEGIN
   SELECT 'foo' FROM DUAL;
Thread
bk commit into 5.1 tree (thek:1.2400)kpettersson1 Dec