Loading mysql-test/r/create.result +2 −2 Original line number Diff line number Diff line Loading @@ -447,8 +447,8 @@ t2 CREATE TABLE `t2` ( `ifnull(c,c)` mediumint(8) default NULL, `ifnull(d,d)` int(11) default NULL, `ifnull(e,e)` bigint(20) default NULL, `ifnull(f,f)` float(24,2) default NULL, `ifnull(g,g)` double(53,3) default NULL, `ifnull(f,f)` float(3,2) default NULL, `ifnull(g,g)` double(4,3) default NULL, `ifnull(h,h)` decimal(5,4) default NULL, `ifnull(i,i)` year(4) default NULL, `ifnull(j,j)` date default NULL, Loading mysql-test/r/temp_table.result +21 −0 Original line number Diff line number Diff line Loading @@ -152,3 +152,24 @@ SELECT * FROM t1; i DROP TABLE t1; End of 4.1 tests. CREATE TABLE t1 ( c FLOAT( 20, 14 ) ); INSERT INTO t1 VALUES( 12139 ); CREATE TABLE t2 ( c FLOAT(30,18) ); INSERT INTO t2 VALUES( 123456 ); SELECT AVG( c ) FROM t1 UNION SELECT 1; AVG( c ) 12139 1 SELECT 1 UNION SELECT AVG( c ) FROM t1; 1 1 12139 SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1; 1 1 123456 SELECT c/1 FROM t1 UNION SELECT 1; c/1 12139 1 DROP TABLE t1, t2; mysql-test/r/type_float.result +4 −4 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `col1` double default NULL, `col2` double(53,5) default NULL, `col2` double(22,5) default NULL, `col3` double default NULL, `col4` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Loading Loading @@ -232,12 +232,12 @@ insert into t2 values ("1.23456780"); create table t3 select * from t2 union select * from t1; select * from t3; d 1.234567800 100000000.000000000 1.2345678 100000000 show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `d` double(22,9) default NULL `d` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2, t3; create table t1 select 105213674794682365.00 + 0.0 x; Loading mysql-test/t/temp_table.test +16 −0 Original line number Diff line number Diff line Loading @@ -163,3 +163,19 @@ DROP TABLE t1; --echo End of 4.1 tests. # # Bug #24791: Union with AVG-groups generates wrong results # CREATE TABLE t1 ( c FLOAT( 20, 14 ) ); INSERT INTO t1 VALUES( 12139 ); CREATE TABLE t2 ( c FLOAT(30,18) ); INSERT INTO t2 VALUES( 123456 ); SELECT AVG( c ) FROM t1 UNION SELECT 1; SELECT 1 UNION SELECT AVG( c ) FROM t1; SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1; SELECT c/1 FROM t1 UNION SELECT 1; DROP TABLE t1, t2; sql/field.h +1 −3 Original line number Diff line number Diff line Loading @@ -432,6 +432,7 @@ class Field_real :public Field_num { int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); uint32 max_display_length() { return field_length; } }; Loading Loading @@ -461,7 +462,6 @@ class Field_decimal :public Field_real { void overflow(bool negative); bool zero_pack() const { return 0; } void sql_type(String &str) const; uint32 max_display_length() { return field_length; } }; Loading Loading @@ -719,7 +719,6 @@ class Field_float :public Field_real { void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(float); } void sql_type(String &str) const; uint32 max_display_length() { return 24; } }; Loading Loading @@ -762,7 +761,6 @@ class Field_double :public Field_real { void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(double); } void sql_type(String &str) const; uint32 max_display_length() { return 53; } uint size_of() const { return sizeof(*this); } }; Loading Loading
mysql-test/r/create.result +2 −2 Original line number Diff line number Diff line Loading @@ -447,8 +447,8 @@ t2 CREATE TABLE `t2` ( `ifnull(c,c)` mediumint(8) default NULL, `ifnull(d,d)` int(11) default NULL, `ifnull(e,e)` bigint(20) default NULL, `ifnull(f,f)` float(24,2) default NULL, `ifnull(g,g)` double(53,3) default NULL, `ifnull(f,f)` float(3,2) default NULL, `ifnull(g,g)` double(4,3) default NULL, `ifnull(h,h)` decimal(5,4) default NULL, `ifnull(i,i)` year(4) default NULL, `ifnull(j,j)` date default NULL, Loading
mysql-test/r/temp_table.result +21 −0 Original line number Diff line number Diff line Loading @@ -152,3 +152,24 @@ SELECT * FROM t1; i DROP TABLE t1; End of 4.1 tests. CREATE TABLE t1 ( c FLOAT( 20, 14 ) ); INSERT INTO t1 VALUES( 12139 ); CREATE TABLE t2 ( c FLOAT(30,18) ); INSERT INTO t2 VALUES( 123456 ); SELECT AVG( c ) FROM t1 UNION SELECT 1; AVG( c ) 12139 1 SELECT 1 UNION SELECT AVG( c ) FROM t1; 1 1 12139 SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1; 1 1 123456 SELECT c/1 FROM t1 UNION SELECT 1; c/1 12139 1 DROP TABLE t1, t2;
mysql-test/r/type_float.result +4 −4 Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ show create table t2; Table Create Table t2 CREATE TABLE `t2` ( `col1` double default NULL, `col2` double(53,5) default NULL, `col2` double(22,5) default NULL, `col3` double default NULL, `col4` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 Loading Loading @@ -232,12 +232,12 @@ insert into t2 values ("1.23456780"); create table t3 select * from t2 union select * from t1; select * from t3; d 1.234567800 100000000.000000000 1.2345678 100000000 show create table t3; Table Create Table t3 CREATE TABLE `t3` ( `d` double(22,9) default NULL `d` double default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2, t3; create table t1 select 105213674794682365.00 + 0.0 x; Loading
mysql-test/t/temp_table.test +16 −0 Original line number Diff line number Diff line Loading @@ -163,3 +163,19 @@ DROP TABLE t1; --echo End of 4.1 tests. # # Bug #24791: Union with AVG-groups generates wrong results # CREATE TABLE t1 ( c FLOAT( 20, 14 ) ); INSERT INTO t1 VALUES( 12139 ); CREATE TABLE t2 ( c FLOAT(30,18) ); INSERT INTO t2 VALUES( 123456 ); SELECT AVG( c ) FROM t1 UNION SELECT 1; SELECT 1 UNION SELECT AVG( c ) FROM t1; SELECT 1 UNION SELECT * FROM t2 UNION SELECT 1; SELECT c/1 FROM t1 UNION SELECT 1; DROP TABLE t1, t2;
sql/field.h +1 −3 Original line number Diff line number Diff line Loading @@ -432,6 +432,7 @@ class Field_real :public Field_num { int store_decimal(const my_decimal *); my_decimal *val_decimal(my_decimal *); uint32 max_display_length() { return field_length; } }; Loading Loading @@ -461,7 +462,6 @@ class Field_decimal :public Field_real { void overflow(bool negative); bool zero_pack() const { return 0; } void sql_type(String &str) const; uint32 max_display_length() { return field_length; } }; Loading Loading @@ -719,7 +719,6 @@ class Field_float :public Field_real { void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(float); } void sql_type(String &str) const; uint32 max_display_length() { return 24; } }; Loading Loading @@ -762,7 +761,6 @@ class Field_double :public Field_real { void sort_string(char *buff,uint length); uint32 pack_length() const { return sizeof(double); } void sql_type(String &str) const; uint32 max_display_length() { return 53; } uint size_of() const { return sizeof(*this); } }; Loading