diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-30 09:04:43 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-09-30 09:04:43 +0300 |
commit | 064cb58efea063595e336e4cd0feccb12d26f8cf (patch) | |
tree | f140b96c8a20172cbb484375e38a7aa481ab660b /sql/sp.cc | |
parent | e5a9dcfda20e174525ad63a30e12f592aa9c96d3 (diff) | |
parent | 57fdd016ce6167c15ba9cd41048b8a42ba582447 (diff) | |
download | mariadb-git-064cb58efea063595e336e4cd0feccb12d26f8cf.tar.gz |
Merge 10.4 into 10.5
FIXME: Part of the MDEV-20699 test is disabled due to
nonderterministic result.
Diffstat (limited to 'sql/sp.cc')
-rw-r--r-- | sql/sp.cc | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/sql/sp.cc b/sql/sp.cc index 46494fb2393..f72cb9c5593 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1931,8 +1931,6 @@ bool Sp_handler::sp_show_create_routine(THD *thd, const Database_qualified_name *name) const { - sp_head *sp; - DBUG_ENTER("sp_show_create_routine"); DBUG_PRINT("enter", ("type: %s name: %.*s", type_str(), @@ -1945,20 +1943,28 @@ Sp_handler::sp_show_create_routine(THD *thd, It is "safe" to do as long as it doesn't affect the results of the binary log or the query cache, which currently it does not. */ - if (sp_cache_routine(thd, name, false, &sp)) - DBUG_RETURN(TRUE); + sp_head *sp= 0; - if (sp == NULL || sp->show_create_routine(thd, this)) + DBUG_EXECUTE_IF("cache_sp_in_show_create", + /* Some tests need just need a way to cache SP without other side-effects.*/ + sp_cache_routine(thd, name, false, &sp); + sp->show_create_routine(thd, this); + DBUG_RETURN(false); + ); + + bool free_sp= db_find_routine(thd, name, &sp) == SP_OK; + bool ret= !sp || sp->show_create_routine(thd, this); + if (ret) { /* If we have insufficient privileges, pretend the routine does not exist. */ my_error(ER_SP_DOES_NOT_EXIST, MYF(0), type_str(), name->m_name.str); - DBUG_RETURN(TRUE); } - - DBUG_RETURN(FALSE); + if (free_sp) + sp_head::destroy(sp); + DBUG_RETURN(ret); } |