Mysql "drop function if exists" fails with code 1305

Borut Tomazin picture Borut Tomazin · Jan 27, 2013 · Viewed 9.9k times · Source

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?

Answer

Kermit picture Kermit · Jan 27, 2013

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.