2012
MariaDBERRORNotableUDFHIGH confidence
Function is not defined
Production Risk
Low — statement is rejected.
What this means
An attempt was made to DROP or execute a User-Defined Function that does not exist in the mysql.func table. The function was never created, was already dropped, or the name is misspelled.
Why it happens
- 1DROP FUNCTION called on a UDF that was never created.
- 2Function name typo.
- 3mysql.func table was manually altered, removing the entry.
How to reproduce
trigger — this will error
trigger — this will error
DROP FUNCTION nonexistent_func;
expected output
ERROR 2012 (HY000): Function 'nonexistent_func' is not defined.
Fix 1
Use DROP FUNCTION IF EXISTS to avoid errors when the function may not exist
Use DROP FUNCTION IF EXISTS to avoid errors when the function may not exist
DROP FUNCTION IF EXISTS nonexistent_func;
Why this works
IF EXISTS suppresses the error when the function does not exist.
Fix 2
Verify installed UDFs
Verify installed UDFs
SELECT * FROM mysql.func;
Why this works
Lists all currently registered UDFs.
Sources
Official documentation ↗
MySQL 8.0 — 2012 ER_FUNCTION_NOT_DEFINED
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev