MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:December 15 2006 9:38am
Subject:bk commit into 5.0 tree (gkodinov:1.2349) BUG#15439
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2006-12-15 11:38:30+02:00, gkodinov@stripped +3 -0
  Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
              the UDF
  When deleting a user defined function MySQL must remove it from both the
  in-memory hash table and the mysql.proc system table.
  Finding (and removal therefore) from the internal hash table is case 
  insensitive (or whatever the default charset is), whereas finding and 
  removal from the system table is case sensitive.
  As a result if you supply a function name that is not in the same character
  case to DROP FUNCTION the server will remove the function only from the
  in-memory hash table and will keep the row in mysql.proc system table.
  This will cause inconsistency between the two structures (that is fixed
  only by restarting the server).
  Fixed by using the name in the precise case (from the in-memory hash table)
  to delete the row in the mysql.proc system table. 

  mysql-test/r/udf.result@stripped, 2006-12-15 11:38:24+02:00, gkodinov@stripped +11 -0
    Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
                the UDF
     - test case

  mysql-test/t/udf.test@stripped, 2006-12-15 11:38:24+02:00, gkodinov@stripped +17 -0
    Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
                the UDF
     - test case

  sql/sql_udf.cc@stripped, 2006-12-15 11:38:25+02:00, gkodinov@stripped +1 -1
    Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
                the UDF
     - use the exact function name in deleting from mysql.proc.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	macbook.gmz
# Root:	/Users/kgeorge/mysql/work/B16589-5.0-opt

--- 1.59/sql/sql_udf.cc	2006-07-18 10:32:42 +03:00
+++ 1.60/sql/sql_udf.cc	2006-12-15 11:38:25 +02:00
@@ -536,7 +536,7 @@ int mysql_drop_function(THD *thd,const L
   tables.table_name= tables.alias= (char*) "func";
   if (!(table = open_ltable(thd,&tables,TL_WRITE)))
     goto err;
-  table->field[0]->store(udf_name->str, udf_name->length, system_charset_info);
+  table->field[0]->store(udf->name.str, udf->name.length, &my_charset_bin);
   table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
   if (!table->file->index_read_idx(table->record[0], 0,
 				   (byte*) table->field[0]->ptr,

--- 1.9/mysql-test/r/udf.result	2006-11-28 21:56:41 +02:00
+++ 1.10/mysql-test/r/udf.result	2006-12-15 11:38:24 +02:00
@@ -194,6 +194,17 @@ DROP FUNCTION sequence;
 DROP FUNCTION lookup;
 DROP FUNCTION reverse_lookup;
 DROP FUNCTION avgcost;
+select * from mysql.func;
+name	ret	dl	type
+CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+select IS_const(3);
+IS_const(3)
+const
+drop function IS_const;
+select * from mysql.func;
+name	ret	dl	type
+select is_const(3);
+ERROR 42000: FUNCTION test.is_const does not exist
 CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
 select
 is_const(3) as const,

--- 1.10/mysql-test/t/udf.test	2006-11-28 21:56:41 +02:00
+++ 1.11/mysql-test/t/udf.test	2006-12-15 11:38:24 +02:00
@@ -188,6 +188,23 @@ DROP FUNCTION reverse_lookup;
 DROP FUNCTION avgcost;
 
 #
+# Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove 
+#             the UDF
+# 
+select * from mysql.func;
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
+select IS_const(3);
+
+drop function IS_const;
+
+select * from mysql.func;
+
+--error 1305
+select is_const(3);
+
+#
 # Bug#18761: constant expression as UDF parameters not passed in as constant
 #
 --replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
Thread
bk commit into 5.0 tree (gkodinov:1.2349) BUG#15439kgeorge15 Dec