Bug #28319 Not found UDF returns usless/wrong error message
Submitted: 9 May 2007 1:51 Modified: 4 Dec 2007 22:14
Reporter: Brian Aker Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S3 (Non-critical)
Version:4.1/5.0/5.1 OS:Any
Assigned to: CPU Architecture:Any

[9 May 2007 1:51] Brian Aker
Description:
Go try to create a udf that does not exist:

mysql> CREATE FUNCTION hello RETURNS STRING SONAME "libskeleton_udf.so";
ERROR 1041 (HY000): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
mysql> 

It should say "not found" not the above.

How to repeat:
See above

Suggested fix:
Return an error message that says that the library was not found (or could not be loaded).
[9 May 2007 2:24] Brian Aker
The message is related to having --skip-grant-table, what needs to be said is that if we have skip-grant-table we have disabled UDF's (which is more then a little bogus I might add).
[9 May 2007 2:42] Brian Aker
And here is the code:

int mysql_create_function(THD *thd,udf_func *udf)
{
  int error;
  void *dl=0;
  bool new_dl=0;
  TABLE *table;
  TABLE_LIST tables;
  udf_func *u_d;
  DBUG_ENTER("mysql_create_function");

  if (!initialized)
  {
    my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
    DBUG_RETURN(1);
  }
[9 May 2007 2:50] MySQL Verification Team
Thank you for the bug report. Verified as described.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.42-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE FUNCTION hello RETURNS STRING SONAME "libskeleton_udf.so";
ERROR 1041 (HY000): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space
mysql> 

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.23-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE FUNCTION hello RETURNS STRING SONAME "libskeleton_udf.so";
ERROR 1041 (HY000): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space

[miguel@light 5.1]$ bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.18-beta-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE FUNCTION hello RETURNS STRING SONAME "libskeleton_udf.so";
ERROR 1041 (HY000): Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap spac
[4 Dec 2007 22:14] Konstantin Osipov
Can't repeat:
mysql> CREATE FUNCTION hello RETURNS STRING SONAME "libskeleton_udf.so";
ERROR 1123 (HY000): Can't initialize function 'hello'; UDFs are unavailable with the --skip-grant-tables option
This is the latest 5.1