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,8 +4128,16 @@ unsent_create_error: ...@@ -4128,8 +4128,16 @@ unsent_create_error:
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)
{
if (lex->spname->m_db.str)
result= SP_KEY_NOT_FOUND; result= SP_KEY_NOT_FOUND;
else 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, if (check_procedure_access(thd, ALTER_PROC_ACL, sp->m_db.str,
sp->m_name.str, 0)) sp->m_name.str, 0))
...@@ -4207,7 +4215,13 @@ unsent_create_error: ...@@ -4207,7 +4215,13 @@ unsent_create_error:
} }
} }
#endif #endif
if (lex->spname->m_db.str)
result= SP_KEY_NOT_FOUND; 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