List:Internals« Previous MessageNext Message »
From:ramil Date:September 9 2005 10:07am
Subject:bk commit into 4.0 tree (ramil:1.2149) BUG#10716
View as plain text  
Below is the list of changes that have just been committed into a local
4.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.2149 05/09/09 15:07:15 ramil@stripped +3 -0
  A fix (bug #10716: Procedure Analyse results in wrong values for optimal field type).

  sql/sql_analyse.cc
    1.23 05/09/09 15:07:08 ramil@stripped +8 -8
    A fix (bug #10716: Procedure Analyse results in wrong values for optimal field type).
    Check for double/float first.

  mysql-test/t/analyse.test
    1.6 05/09/09 15:07:08 ramil@stripped +8 -0
    A fix (bug #10716: Procedure Analyse results in wrong values for optimal field type).

  mysql-test/r/analyse.result
    1.7 05/09/09 15:07:08 ramil@stripped +6 -0
    A fix (bug #10716: Procedure Analyse results in wrong values for optimal field 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:	gw.mysql.r18.ru
# Root:	/usr/home/ram/work/mysql-4.0

--- 1.22/sql/sql_analyse.cc	2004-09-07 13:40:26 +05:00
+++ 1.23/sql/sql_analyse.cc	2005-09-09 15:07:08 +05:00
@@ -791,7 +791,14 @@
 {
   char buff[MAX_FIELD_WIDTH];
 
-  if (!max_notzero_dec_len)
+  if (item->decimals == NOT_FIXED_DEC)
+  {
+    if (min_arg >= -FLT_MAX && max_arg <= FLT_MAX)
+      answer->append("FLOAT", 5);      
+    else
+      answer->append("DOUBLE", 6);
+  }
+  else if (!max_notzero_dec_len)
   {
     if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127))
       sprintf(buff, "TINYINT(%d)", (int) max_length - (item->decimals + 1));
@@ -809,13 +816,6 @@
     answer->append(buff, (uint) strlen(buff));
     if (min_arg >= 0)
       answer->append(" UNSIGNED");
-  }
-  else if (item->decimals == NOT_FIXED_DEC)
-  {
-    if (min_arg >= -FLT_MAX && max_arg <= FLT_MAX)
-      answer->append("FLOAT", 5);      
-    else
-      answer->append("DOUBLE", 6);
   }
   else
   {

--- 1.6/mysql-test/r/analyse.result	2003-03-13 17:34:04 +04:00
+++ 1.7/mysql-test/r/analyse.result	2005-09-09 15:07:08 +05:00
@@ -24,3 +24,9 @@
 t1.bool	N	Y	1	1	0	0	1.0000	NULL	ENUM('N','Y') NOT NULL
 t1.d	2002-03-03	2002-03-05	10	10	0	0	10.0000	NULL	ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
 drop table t1,t2;
+create table t1 (a double not null);
+insert into t1 values ('100000');
+select * from t1 procedure analyse (1, 1);
+Field_name	Min_value	Max_value	Min_length	Max_length	Empties_or_zeros	Nulls	Avg_value_or_avg_length	Std	Optimal_fieldtype
+t1.a	100000	100000	6	6	0	0	100000	0	FLOAT NOT NULL
+drop table t1;

--- 1.5/mysql-test/t/analyse.test	2003-03-13 16:44:00 +04:00
+++ 1.6/mysql-test/t/analyse.test	2005-09-09 15:07:08 +05:00
@@ -11,3 +11,11 @@
 select * from t2;
 drop table t1,t2;
 
+#
+# Bug #10716: problem with double
+#
+
+create table t1 (a double not null);
+insert into t1 values ('100000');
+select * from t1 procedure analyse (1, 1);
+drop table t1;
Thread
bk commit into 4.0 tree (ramil:1.2149) BUG#10716ramil9 Sep