Commit 99b986d0 authored by unknown's avatar unknown
Browse files

Fixed BUG#6663: Stored Procedures code report non-selected DB

                when CREATE but not when ALTER


sql/sql_parse.cc:
  Return more consistent error message for alter/drop procedure/function
  when no current database and no qualified name.
parent 281fe07f
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -4128,8 +4128,16 @@ mysql_execute_command(THD *thd)
	sp= sp_find_function(thd, lex->spname);
      mysql_reset_errors(thd, 0);
      if (! sp)
      {
	if (lex->spname->m_db.str)
	  result= SP_KEY_NOT_FOUND;
	else
	{
	  my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
	  goto error;
	}
      }
      else
      {
        if (check_procedure_access(thd, ALTER_PROC_ACL, sp->m_db.str, 
				  sp->m_name.str, 0))
@@ -4207,7 +4215,13 @@ mysql_execute_command(THD *thd)
	  }
	}
#endif
	if (lex->spname->m_db.str)
	  result= SP_KEY_NOT_FOUND;
	else
	{
	  my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
	  goto error;
	}
      }
      res= result;
      switch (result)