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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With