MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:ramil Date:November 22 2005 2:29pm
Subject:bk commit into 5.0 tree (ramil:1.1984) BUG#10966
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram 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
  1.1984 05/11/22 18:29:46 ramil@stripped +4 -0
  Fix for bug #10966: Variance functions return wrong data type.

  sql/item_sum.h
    1.95 05/11/22 18:29:36 ramil@stripped +1 -1
    Fix for bug #10966: Variance functions return wrong data type.

  sql/item_sum.cc
    1.168 05/11/22 18:29:36 ramil@stripped +0 -3
    Fix for bug #10966: Variance functions return wrong data type.
    Always return Field_double if no grouping.

  mysql-test/t/func_group.test
    1.46 05/11/22 18:29:36 ramil@stripped +11 -0
    Fix for bug #10966: Variance functions return wrong data type.

  mysql-test/r/func_group.result
    1.47 05/11/22 18:29:36 ramil@stripped +14 -0
    Fix for bug #10966: Variance functions return wrong data type.

# 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:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/5.0.b10966

--- 1.167/sql/item_sum.cc	2005-11-01 18:21:43 +04:00
+++ 1.168/sql/item_sum.cc	2005-11-22 18:29:36 +04:00
@@ -1030,9 +1030,6 @@ Field *Item_sum_variance::create_tmp_fie
                              sizeof(double)*2) + sizeof(longlong),
                             0, name, table, &my_charset_bin);
   }
-  if (hybrid_type == DECIMAL_RESULT)
-    return new Field_new_decimal(max_length, maybe_null, name, table,
-                                 decimals, unsigned_flag);
   return new Field_double(max_length, maybe_null,name,table,decimals);
 }
 

--- 1.94/sql/item_sum.h	2005-09-09 12:44:07 +05:00
+++ 1.95/sql/item_sum.h	2005-11-22 18:29:36 +04:00
@@ -481,7 +481,7 @@ public:
     { return sample ? "var_samp(" : "variance("; }
   Item *copy_or_same(THD* thd);
   Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length);
-  enum Item_result result_type () const { return hybrid_type; }
+  enum Item_result result_type () const { return REAL_RESULT; }
 };
 
 class Item_sum_std;

--- 1.46/mysql-test/r/func_group.result	2005-09-23 12:18:52 +05:00
+++ 1.47/mysql-test/r/func_group.result	2005-11-22 18:29:36 +04:00
@@ -1089,3 +1089,17 @@ SUM(a)
 6
 DROP TABLE t1;
 set div_precision_increment= @sav_dpi;
+create table t1 select variance(0);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `variance(0)` double(8,4) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 select stddev(0);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `stddev(0)` double(8,4) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;

--- 1.45/mysql-test/t/func_group.test	2005-11-16 18:16:53 +04:00
+++ 1.46/mysql-test/t/func_group.test	2005-11-22 18:29:36 +04:00
@@ -703,3 +703,14 @@ SELECT SUM(a) FROM t1 GROUP BY b/c;
 DROP TABLE t1;
 set div_precision_increment= @sav_dpi;
 
+#
+# Bug #10966: Variance functions return wrong data type
+#
+
+create table t1 select variance(0);                                               
+show create table t1;                                                           
+drop table t1;                                                                  
+create table t1 select stddev(0);
+show create table t1;
+drop table t1;
+ 
\ No newline at end of file
Thread
bk commit into 5.0 tree (ramil:1.1984) BUG#10966ramil22 Nov