1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-7283 UDF: CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS

MDEV-7282 SP: CREATE OR REPLACE, CREATE IF NOT EXISTS
This commit is contained in:
Alexander Barkov
2014-12-15 17:41:15 +04:00
parent 48ed8ab215
commit 2dbd26932d
23 changed files with 1011 additions and 147 deletions

View File

@ -4480,7 +4480,9 @@ end_with_restore_list:
#endif
case SQLCOM_CREATE_FUNCTION: // UDF function
{
if (check_access(thd, INSERT_ACL, "mysql", NULL, NULL, 1, 0))
if (check_access(thd, lex->create_info.or_replace() ?
(INSERT_ACL | DELETE_ACL) : INSERT_ACL,
"mysql", NULL, NULL, 1, 0))
break;
#ifdef HAVE_DLOPEN
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
@ -4950,6 +4952,15 @@ end_with_restore_list:
goto create_sp_error;
}
/* Checking the drop permissions if CREATE OR REPLACE is used */
if (lex->create_info.or_replace())
{
if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str,
lex->spname->m_name.str,
lex->sql_command == SQLCOM_DROP_PROCEDURE, 0))
goto create_sp_error;
}
name= lex->sphead->name(&namelen);
#ifdef HAVE_DLOPEN
if (lex->sphead->m_type == TYPE_ENUM_FUNCTION)