Error
Error Code:
1630
MariaDB Error 1630: Function Does Not Exist
Description
MariaDB Error 1630 indicates that the database server could not locate a function with the specified name during query execution. This typically occurs when a function is called that is either misspelled, not yet created, or inaccessible in the current database context.
Error Message
FUNCTION %s does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
Known Causes
4 known causesTypo in Function Name
The function name specified in your SQL statement contains a spelling error, causing MariaDB to search for a non-existent function.
Function Not Defined
The user-defined function (UDF) being called has not been created or loaded into the MariaDB server instance.
Incorrect Database Context
The function exists but is defined in a different database or schema than the one currently in use, and its name was not fully qualified.
Insufficient Permissions
The executing user account lacks the necessary EXECUTE or USAGE privileges on the function in question.
Solutions
4 solutions available1. Verify Function Name and Case Sensitivity easy
Ensure the function name is spelled correctly and matches the case if your MariaDB server is configured for case-sensitive object names.
1
Double-check the exact spelling of the function name in your SQL query.
SELECT my_custom_function(column_name) FROM my_table;
2
If you are unsure about case sensitivity, query the `mysql.general_log` (if enabled) or check your `lower_case_table_names` system variable. Note that function names are typically case-insensitive on most systems, but it's good practice to be aware.
SHOW VARIABLES LIKE 'lower_case_table_names';
3
If the function name is incorrect, correct it in your query and re-execute.
SELECT correct_function_name(column_name) FROM my_table;
2. Check Function Existence and Schema easy
Confirm that the function actually exists in the database and that you are referencing it correctly, especially if it's in a different schema.
1
Query the `information_schema.ROUTINES` table to list all available functions and their schemas.
SELECT routine_schema, routine_name FROM information_schema.ROUTINES WHERE routine_type = 'FUNCTION' AND routine_name = 'your_function_name';
-- Or to list all functions:
SELECT routine_schema, routine_name FROM information_schema.ROUTINES WHERE routine_type = 'FUNCTION';
2
If the function exists but is in a different schema, qualify the function call with the schema name.
SELECT your_schema.your_function_name(column_name) FROM my_table;
3
If the function does not appear in the list, it has not been created or dropped. You will need to create it first.
-- Example of creating a function:
DELIMITER //
CREATE FUNCTION my_new_function(input_value INT) RETURNS INT
BEGIN
RETURN input_value * 2;
END //
DELIMITER ;
3. Inspect User Privileges for Functions medium
Verify that the user executing the query has the necessary privileges to execute the function.
1
Check the privileges granted to the user for the specific function or for all functions in the schema.
SHOW GRANTS FOR 'your_user'@'your_host';
-- Look for 'EXECUTE' privilege on the function or schema.
2
If the user lacks the 'EXECUTE' privilege, grant it.
GRANT EXECUTE ON FUNCTION your_schema.your_function_name TO 'your_user'@'your_host';
-- Or to grant for all functions in a schema:
GRANT EXECUTE ON *.* TO 'your_user'@'your_host'; -- Use with caution, grants all execute privileges.
3
After granting privileges, the user may need to reconnect to the database for the changes to take effect.
QUIT
-- Then reconnect using their client.
4. Review Function Definition and Dependencies advanced
Ensure the function was created correctly and that any user-defined functions it depends on are also available.
1
Retrieve the definition of the function to inspect its code for any errors or incorrect references to other functions.
SHOW CREATE FUNCTION your_schema.your_function_name;
2
If the function calls other user-defined functions, verify that those dependent functions also exist and are accessible.
-- Repeat step 2 for any functions called within your_function_name.
3
If the function definition appears correct, consider recompiling or recreating the function if you suspect corruption or an outdated definition.
DROP FUNCTION your_schema.your_function_name;
-- Then recreate the function using its definition.