Bug #54435 Importing a mysqldump with a UDF from another system
Submitted: 11 Jun 2010 16:25 Modified: 10 Jul 2011 16:54
Reporter: Rolf Martin-Hoster Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S2 (Serious)
Version:5.1.48 OS:Any
Assigned to: CPU Architecture:Any

[11 Jun 2010 16:25] Rolf Martin-Hoster
Description:
When importing a mysql with a UDF from another system you cannot drop/recreate the UDF without restarting mysql. You can delete it from mysql.func but it will still be registered in memory some where.

How to repeat:
mysql> create function mail returns integer soname 'udf_mail.so';
ERROR 1125 (HY000): Function 'mail' already exists
mysql> drop function mail;
ERROR 1305 (42000): FUNCTION mynatnet.mail does not exist

restart mysql

mysql> create function mail returns integer soname 'udf_mail.so';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    326
Current database: mynatnet

Query OK, 0 rows affected (3.71 sec)

mysql> select mail('test@test.com', 'test')
    -> ;
+-------------------------------+
| mail('test@test.com', 'test') |
+-------------------------------+
|                             0 |
+-------------------------------+
1 row in set (0.18 sec)

Suggested fix:
Add this to one of the FLUSH functions? Or if its done in one of the FLUSH statements, add it to the documentation.
[11 Jun 2010 16:54] Sveta Smirnova
Thank you for the report.

Which exact version of MySQL do you use?
[11 Jul 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[12 Jul 2010 1:38] Rolf Martin-Hoster
5.x I've had this same recurring issue 4 or more times.
[12 Jul 2010 5:51] Sveta Smirnova
Thank you for the feedback.

Which exact minor version of MySQL server do you use?
[12 Jul 2010 10:39] Rolf Martin-Hoster
The current GA 5.1.48. I've experienced the issue across multiple versions of 5.0 and 5.1.
[12 Jul 2010 10:43] Sveta Smirnova
Thank you for the feedback.

Could you please send us example of code for problem function: problem is not repeatable for me with UDFs from our test suite.
[12 Aug 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[9 Jun 2011 3:23] EE Durham
don't use the schema name in your drop statement.
to drop and recreate, use:
drop function mail;
create function mail returns integer soname 'udf_sql_mail.so';

expected results:
Statement:6/8/2011 11:17:42 PM 0:00:00.263: Executed Successfully
1: drop function mail
Statement:6/8/2011 11:17:43 PM 0:00:00.286: Executed Successfully
2: create function mail returns integer soname 'udf_sql_mail.so'
[9 Jun 2011 3:26] EE Durham
(you don't use the schema name because it is a udf function)
[9 Jun 2011 14:59] Rolf Martin-Hoster
Please reread the original bug. No schema was being defined. This only occurs after doing a restore from a dump.
[10 Jun 2011 16:54] Sveta Smirnova
Rolf,

thank you for the feedback.

Could you please send us example of code for problem function: problem
is not repeatable for me with UDFs from our test suite.
[10 Jul 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".