MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:March 7 2007 7:12pm
Subject:bk commit into 5.0 tree (evgen:1.2432) BUG#25373
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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, 2007-03-07 22:11:57+03:00, evgen@stripped +3 -0
  Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
  result.
  
  For built-in functions like sqrt() function names are hard-coded and can be
  compared by pointer. But this isn't the case for a used-defined stored
  functions - names there are dynamical and should be compared as strings.
  
  Now the Item_func::eq() function employs my_strcasecmp() function to compare
  used-defined stored functions names.

  mysql-test/r/sp.result@stripped, 2007-03-07 22:05:53+03:00, evgen@stripped +13 -0
    Added a test case for bug#25373: Stored functions wasn't compared correctly which leads to a wrong result.

  mysql-test/t/sp.test@stripped, 2007-03-07 22:05:47+03:00, evgen@stripped +15 -0
    Added a test case for bug#25373: Stored functions wasn't compared correctly which leads to a wrong result.

  sql/item_func.cc@stripped, 2007-03-07 22:05:57+03:00, evgen@stripped +7 -2
    Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
    result.
    Now the Item_func::eq() function employs my_strcasecmp() function to compare
    used-defined stored functions names.

# 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:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/25373-bug-5.0-opt-mysql

--- 1.322/sql/item_func.cc	2007-02-21 14:05:00 +03:00
+++ 1.323/sql/item_func.cc	2007-03-07 22:05:57 +03:00
@@ -409,8 +409,13 @@
   if (item->type() != FUNC_ITEM)
     return 0;
   Item_func *item_func=(Item_func*) item;
-  if (arg_count != item_func->arg_count ||
-      func_name() != item_func->func_name())
+  Item_func::Functype func_type;
+  if ((func_type= functype()) != item_func->functype() ||
+      arg_count != item_func->arg_count ||
+      (func_type != Item_func::FUNC_SP &&
+       func_name() != item_func->func_name()) ||
+      (func_type == Item_func::FUNC_SP &&
+       my_strcasecmp(system_charset_info, func_name(), item_func->func_name())))
     return 0;
   for (uint i=0; i < arg_count ; i++)
     if (!args[i]->eq(item_func->args[i], binary_cmp))

--- 1.218/mysql-test/r/sp.result	2007-01-18 20:05:03 +03:00
+++ 1.219/mysql-test/r/sp.result	2007-03-07 22:05:53 +03:00
@@ -5741,4 +5741,17 @@
 CALL bug24117()|
 DROP PROCEDURE bug24117|
 DROP TABLE t3|
+DROP FUNCTION IF EXISTS bug25373|
+CREATE FUNCTION bug25373(p1 INTEGER) RETURNS INTEGER
+LANGUAGE SQL DETERMINISTIC
+RETURN p1;|
+CREATE TABLE t3 (f1 INT, f2 FLOAT)|
+INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
+SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
+SUM(f2)	bug25373(f1)
+6.3000000715256	1
+15	2
+21.300000071526	NULL
+DROP FUNCTION bug25373|
+DROP TABLE t3|
 drop table t1,t2;

--- 1.208/mysql-test/t/sp.test	2007-01-18 20:05:03 +03:00
+++ 1.209/mysql-test/t/sp.test	2007-03-07 22:05:47 +03:00
@@ -6715,6 +6715,21 @@
 DROP TABLE t3|
 
 #
+# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
+#            result.
+#
+--disable_warnings
+DROP FUNCTION IF EXISTS bug25373|
+--disable_warnings
+CREATE FUNCTION bug25373(p1 INTEGER) RETURNS INTEGER
+LANGUAGE SQL DETERMINISTIC
+RETURN p1;|
+CREATE TABLE t3 (f1 INT, f2 FLOAT)|
+INSERT INTO t3 VALUES (1, 3.4), (1, 2), (1, 0.9), (2, 8), (2, 7)|
+SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP|
+DROP FUNCTION bug25373|
+DROP TABLE t3|
+#
 # NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
 #       at the end of the file!
 #
Thread
bk commit into 5.0 tree (evgen:1.2432) BUG#25373eugene7 Mar