diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2020-07-29 21:54:24 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2020-10-11 12:30:41 +0200 |
commit | 5b86139118d8fe32b90caeaa4282edc2879cfcb5 (patch) | |
tree | 3bb6d8011b0b8c092124e9eba90330d1cb207105 /sql/sql_parse.cc | |
parent | 222e1b806ff93083a62f740f6d247f8081983592 (diff) | |
download | mariadb-git-bb-10.2-MDEV-23327.tar.gz |
MDEV-23327 Can't uninstall UDF if the implementation library file doesn't existbb-10.2-MDEV-23327
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.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 543c877b7f1..969e33b2353 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5620,23 +5620,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()) |