MySQL says incorrect parameter count for function I've created even tho it's right I'm migrating my webapp from local to DigitalOcean, and I'm having a problem using a routine I've created. It works fine locally(version 5.5.50) but on the online MySQL(version 5.7.13) it gives me the following error:


  #1582 - Incorrect parameter count in the call to native function 'DISTANCE'


even tho the call is right.

I have deleted the function and it still gives me the same error, therefore I think it's not even being able to find my function.

I've tried to grant all privileges to my user and it's still not working.
The problem is that there was a native function distance() added in MySQL 5.7.5, which takes 2 arguments:

Distance() was added in MySQL 5.7.5.
Distance() is deprecated as of MySQL 5.7.6 and will be removed in a future MySQL release. Use ST_Distance() instead.

It will be removed in a later release, but unfortunately you would need to rename your function. Had you not dropped it, you could have changed the function call in the app to include the schema:

The preceding function name resolution rules have implications for upgrading to versions of MySQL that implement new built-in functions:

If you have already created a user-defined function with a given name and upgrade MySQL to a version that implements a new built-in function with the same name, the UDF becomes inaccessible. To correct this, use DROP FUNCTION to drop the UDF and CREATE FUNCTION to re-create the UDF with a different nonconflicting name. Then modify any affected code to use the new name.

If a new version of MySQL implements a built-in function with the same name as an existing stored function, you have two choices: Rename the stored function to use a nonconflicting name, or change calls to the function so that they use a schema qualifier (that is, use schema_name.func_name() syntax). In either case, modify any affected code accordingly.



[source]