From ba82a6a759643d287810f814ad2f7b7f54c71e5f Mon Sep 17 00:00:00 2001 From: "hf@deer.(none)" <> Date: Sat, 15 Oct 2005 19:47:23 +0500 Subject: [PATCH 1/4] Fix for bug #9855 (Inconsistend column type in create select) --- mysql-test/r/func_gconcat.result | 6 +++--- mysql-test/r/subselect.result | 6 +++--- mysql-test/r/type_float.result | 22 ++++++++++++++++++++++ mysql-test/t/type_float.test | 17 +++++++++++++++++ sql/item_func.cc | 9 +++++++++ 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index d7a741827d5..200b4a4d53b 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -131,9 +131,9 @@ grp group_concat(a separator "")+0 3 456789 select grp, group_concat(a separator "")+0.0 from t1 group by grp; grp group_concat(a separator "")+0.0 -1 1.0 -2 23.0 -3 456789.0 +1 1 +2 23 +3 456789 select grp, ROUND(group_concat(a separator "")) from t1 group by grp; grp ROUND(group_concat(a separator "")) 1 1 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 4c795abe986..500aa4b1728 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -213,9 +213,9 @@ select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from a select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; b (select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) -8 7.5000 -8 4.5000 -9 7.5000 +8 7.5 +8 4.5 +9 7.5 explain extended select b,(select avg(t2.a+(select min(t3.a) from t3 where t3.a >= t4.a)) from t2) from t4; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t4 ALL NULL NULL NULL NULL 3 diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result index 6e381192270..e8daeb08526 100644 --- a/mysql-test/r/type_float.result +++ b/mysql-test/r/type_float.result @@ -250,3 +250,25 @@ t3 CREATE TABLE `t3` ( `d` double(22,9) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1, t2, t3; +create table t1 select 105213674794682365.00 + 0.0 x; +show warnings; +Level Code Message +desc t1; +Field Type Null Key Default Extra +x double 0 +drop table t1; +create table t1 select 0.0 x; +desc t1; +Field Type Null Key Default Extra +x double(3,1) 0.0 +create table t2 select 105213674794682365.00 y; +desc t2; +Field Type Null Key Default Extra +y double(21,2) 0.00 +create table t3 select x+y a from t1,t2; +show warnings; +Level Code Message +desc t3; +Field Type Null Key Default Extra +a double 0 +drop table t1,t2,t3; diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test index abaf72ea2ed..75723d2a0ff 100644 --- a/mysql-test/t/type_float.test +++ b/mysql-test/t/type_float.test @@ -162,4 +162,21 @@ show create table t3; drop table t1, t2, t3; +# +# Bug #9855 (inconsistent column type for create select +# +create table t1 select 105213674794682365.00 + 0.0 x; +show warnings; +desc t1; +drop table t1; + +create table t1 select 0.0 x; +desc t1; +create table t2 select 105213674794682365.00 y; +desc t2; +create table t3 select x+y a from t1,t2; +show warnings; +desc t3; +drop table t1,t2,t3; + # End of 4.1 tests diff --git a/sql/item_func.cc b/sql/item_func.cc index 288859443ff..019147e151f 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -359,10 +359,19 @@ String *Item_num_func::val_str(String *str) void Item_func::fix_num_length_and_dec() { + uint fl_length= 0; decimals=0; for (uint i=0 ; i < arg_count ; i++) + { set_if_bigger(decimals,args[i]->decimals); + set_if_bigger(fl_length, args[i]->max_length); + } max_length=float_length(decimals); + if (fl_length > max_length) + { + decimals= NOT_FIXED_DEC; + max_length= float_length(NOT_FIXED_DEC); + } } Item *Item_func::get_tmp_table_item(THD *thd) From 1fcecea7a372f451c51c22cc355cbf8cd09ace6b Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Sat, 10 Dec 2005 18:20:00 +0400 Subject: [PATCH 2/4] Fix for bug #14320 (MBROverlaps does wrong test) --- sql/spatial.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/spatial.h b/sql/spatial.h index ec5e80e00fd..206958b3eaf 100644 --- a/sql/spatial.h +++ b/sql/spatial.h @@ -142,7 +142,7 @@ struct MBR bool inner_point(double x, double y) const { /* The following should be safe, even if we compare doubles */ - return (xminx) && (yminx); + return (xminx) && (yminy); } int overlaps(const MBR *mbr) From 6a8f762ecd257370668d156a58417ef750e5ac7b Mon Sep 17 00:00:00 2001 From: "holyfoot@deer.(none)" <> Date: Mon, 19 Dec 2005 14:21:42 +0400 Subject: [PATCH 3/4] bug #15429 (Test 'func_math' not prepared for 'classic' build) --- mysql-test/t/func_math.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index a8f62e38e86..c22c09ab62b 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -91,7 +91,9 @@ drop table t1; # # InnoDB is required to reproduce the fault, but it is okay if we default to # MyISAM when testing. +--disable_warnings create table t1 (a varchar(90), ts datetime not null, index (a)) engine=innodb default charset=utf8; +--enable_warnings insert into t1 values ('http://www.foo.com/', now()); select a from t1 where a='http://www.foo.com/' order by abs(timediff(ts, 0)); drop table t1; From c079e801228dd5a1d77e262c0a030a810eeda6a4 Mon Sep 17 00:00:00 2001 From: "stewart@mysql.com" <> Date: Fri, 20 Jan 2006 00:08:26 +1100 Subject: [PATCH 4/4] reintroduce --no-defaults to ndb_mgmd --- mysql-test/ndb/ndbcluster.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/ndb/ndbcluster.sh b/mysql-test/ndb/ndbcluster.sh index d3471b6cfde..16bb3a9b122 100644 --- a/mysql-test/ndb/ndbcluster.sh +++ b/mysql-test/ndb/ndbcluster.sh @@ -135,7 +135,7 @@ if [ ! -x "$exec_waiter" ]; then fi exec_mgmtclient="$exec_mgmtclient --no-defaults $NDB_MGM_EXTRA_OPTS" -exec_mgmtsrvr="$exec_mgmtsrvr $NDB_MGMD_EXTRA_OPTS" +exec_mgmtsrvr="$exec_mgmtsrvr --no-defaults $NDB_MGMD_EXTRA_OPTS" exec_ndb="$exec_ndb --no-defaults $NDBD_EXTRA_OPTS" exec_waiter="$exec_waiter --no-defaults"