MySQL 5.1 [1305] function does not exist

3.9k views Asked by At

I have to add a function to my local MySQL as it is defined on the remote server for testing purposes.

But when I add a function like

CREATE FUNCTION test(test VARCHAR(64))
RETURNS VARCHAR(64)
BEGIN
    return test;
END;

The function is created and visible in the ROUTINES table but when I try to use it

SELECT test();

I get an error

[42000][1305] FUNCTION test does not exist

This works absolutely fine on MySQL 5.7 but I can't seem to get it to work at all on 5.1

Any leads would be greatly appreciated.

1

There are 1 answers

1
wchiquito On

I can't reproduce the problem:

mysql> SELECT VERSION();
+------------------+
| VERSION()        |
+------------------+
| 5.1.73-community |
+------------------+
1 row in set (0.00 sec)

mysql> DELIMITER $$

mysql> DROP FUNCTION IF EXISTS `test`$$
Query OK, 0 rows affected (0.01 sec)

mysql> CREATE FUNCTION `test`(`test` VARCHAR(64))
    -> RETURNS VARCHAR(64)
    -> BEGIN
    ->   RETURN `test`;
    -> END$$
Query OK, 0 rows affected (0.00 sec)

mysql> DELIMITER ;

mysql> SELECT `test`('MySQL');
+-----------------+
| `test`('MySQL') |
+-----------------+
| MySQL           |
+-----------------+
1 row in set (0.02 sec)