summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2020-07-29 21:54:24 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2020-10-19 15:15:04 +0200
commitbba22543b1556a5e3bc7ecd59d9d794dc4e5a1ed (patch)
tree75347057e7c1d1883b2e4745634c1c5dde6aa806 /sql/sql_parse.cc
parent95bb3cb886cb64be3ee5ace660bb78618dd4c1d0 (diff)
downloadmariadb-git-bba22543b1556a5e3bc7ecd59d9d794dc4e5a1ed.tar.gz
MDEV-23327 Can't uninstall UDF if the implementation library file doesn't exist
Made cleanup of DROP (udf) FUNCTION procedure and also check of mysql.func (not only loaded udf).
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e34181e2eeb..5dddbf0360d 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5623,23 +5623,20 @@ mysql_execute_command(THD *thd)
! lex->spname->m_explicit_name)
{
/* DROP FUNCTION <non qualified name> */
- udf_func *udf = find_udf(lex->spname->m_name.str,
- lex->spname->m_name.length);
- if (udf)
+ enum drop_udf_result rc= mysql_drop_function(thd,
+ &lex->spname->m_name);
+ if (rc == UDF_DEL_RESULT_DELETED)
{
- if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 0))
- goto error;
+ my_ok(thd);
+ break;
+ }
- if (!(res = mysql_drop_function(thd, &lex->spname->m_name)))
- {
- my_ok(thd);
- break;
- }
- my_error(ER_SP_DROP_FAILED, MYF(0),
- "FUNCTION (UDF)", lex->spname->m_name.str);
+ if (rc == UDF_DEL_RESULT_ERROR)
goto error;
- }
+ DBUG_ASSERT(rc == UDF_DEL_RESULT_ABSENT);
+
+ // If there was no current database, so it can not be SP
if (lex->spname->m_db.str == NULL)
{
if (lex->if_exists())