Commit 99b986d0 authored by unknown's avatar unknown

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
...@@ -4128,7 +4128,15 @@ mysql_execute_command(THD *thd) ...@@ -4128,7 +4128,15 @@ mysql_execute_command(THD *thd)
sp= sp_find_function(thd, lex->spname); sp= sp_find_function(thd, lex->spname);
mysql_reset_errors(thd, 0); mysql_reset_errors(thd, 0);
if (! sp) if (! sp)
result= SP_KEY_NOT_FOUND; {
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 else
{ {
if (check_procedure_access(thd, ALTER_PROC_ACL, sp->m_db.str, if (check_procedure_access(thd, ALTER_PROC_ACL, sp->m_db.str,
...@@ -4207,7 +4215,13 @@ mysql_execute_command(THD *thd) ...@@ -4207,7 +4215,13 @@ mysql_execute_command(THD *thd)
} }
} }
#endif #endif
result= SP_KEY_NOT_FOUND; 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; res= result;
switch (result) switch (result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment