List:Internals« Previous MessageNext Message »
From:holyfoot Date:October 15 2005 2:47pm
Subject:bk commit into 4.1 tree (hf:1.2448) BUG#9855
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf 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.2448 05/10/15 19:47:23 hf@deer.(none) +5 -0
  Fix for bug #9855 (Inconsistend column type in create select)

  sql/item_func.cc
    1.256 05/10/15 19:46:09 hf@deer.(none) +9 -0
    Now we set decimals to NOT_FIXED_DEC if the max_length is longer than
    maximum possible double length

  mysql-test/t/type_float.test
    1.21 05/10/15 19:46:09 hf@deer.(none) +17 -0
    testcase added

  mysql-test/r/type_float.result
    1.35 05/10/15 19:46:09 hf@deer.(none) +22 -0
    result fixed

  mysql-test/r/subselect.result
    1.174 05/10/15 19:46:09 hf@deer.(none) +3 -3
    result fixed

  mysql-test/r/func_gconcat.result
    1.42 05/10/15 19:46:09 hf@deer.(none) +3 -3
    result fixed

# 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:	hf
# Host:	deer.(none)
# Root:	/home/hf/work/mysql-4.1.9855

--- 1.255/sql/item_func.cc	Fri Oct  7 09:50:32 2005
+++ 1.256/sql/item_func.cc	Sat Oct 15 19:46:09 2005
@@ -359,10 +359,19 @@
 
 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)

--- 1.173/mysql-test/r/subselect.result	Wed Oct 12 12:39:59 2005
+++ 1.174/mysql-test/r/subselect.result	Sat Oct 15 19:46:09 2005
@@ -213,9 +213,9 @@
 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	

--- 1.34/mysql-test/r/type_float.result	Tue Sep 27 15:31:35 2005
+++ 1.35/mysql-test/r/type_float.result	Sat Oct 15 19:46:09 2005
@@ -250,3 +250,25 @@
   `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;

--- 1.20/mysql-test/t/type_float.test	Tue Sep 27 15:10:42 2005
+++ 1.21/mysql-test/t/type_float.test	Sat Oct 15 19:46:09 2005
@@ -162,4 +162,21 @@
 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

--- 1.41/mysql-test/r/func_gconcat.result	Thu Sep  8 04:33:06 2005
+++ 1.42/mysql-test/r/func_gconcat.result	Sat Oct 15 19:46:09 2005
@@ -131,9 +131,9 @@
 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
Thread
bk commit into 4.1 tree (hf:1.2448) BUG#9855holyfoot15 Oct