1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-5.0-maint

into  mysql.com:/usr/home/ram/work/5.0.b10966
This commit is contained in:
ramil/ram@mysql.com/myoffice.izhnet.ru
2006-07-23 12:58:26 +05:00
4 changed files with 26 additions and 4 deletions

View File

@@ -988,3 +988,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;

View File

@@ -660,3 +660,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;

View File

@@ -1256,9 +1256,6 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table,
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);
}

View File

@@ -688,7 +688,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;