Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql "drop function if exists" fails with code 1305

Tags:

mysql

sql-drop

When I try to execute the code bellow I get mysql error 1305:

DROP FUNCTION IF EXISTS myFunction;

It only fails when function does not exist. But why? Isn't that the cleanup step before you re-create functions?

like image 751
Borut Tomazin Avatar asked Jan 27 '13 17:01

Borut Tomazin


People also ask

What is error code 1305 mysql?

If the user neither has privilege to the routine nor the SELECT privilege on mysql. proc table, it raises Error 1305, informing them that the procedure does not exist.

How do I drop a function in mysql?

To drop a function, you must have the DELETE privilege for the mysql database. This is because DROP FUNCTION removes the row from the mysql. func system table that records the function's name, type and shared library name. For dropping a stored function, see DROP FUNCTION.

What is drop function?

Description. DROP FUNCTION removes the definition of an existing function. To execute this command the user must be the owner of the function. The argument types to the function must be specified, since several different functions can exist with the same name and different argument lists.


1 Answers

MySQL bug #33813 explains that it may be due to case-sensitivity:

Since MySQL 5.0.52, DROP FUNCTION commands taking schema-qualified function names compare the schema name on a case-sensitive basis, even when lower_case_table_names is set to 1. This means that functions are not correctly identified.

like image 147
Kermit Avatar answered Oct 13 '22 23:10

Kermit