List:Internals« Previous MessageNext Message »
From:ramil Date:April 19 2005 11:45am
Subject:bk commit into 4.1 tree (ramil:1.2197) BUG#9837
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2197 05/04/19 14:44:54 ramil@stripped +3 -0
  A fix (bug #9837: round(1, 6) delivers wrong value in create table context).

  sql/item_func.cc
    1.239 05/04/19 14:44:50 ramil@stripped +2 -0
    A fix (bug #9837: round(1, 6) delivers wrong value in create table context).
    As we change decimals, we should change max_length accordingly.

  mysql-test/t/func_math.test
    1.14 05/04/19 14:44:50 ramil@stripped +13 -0
    A fix (bug #9837: round(1, 6) delivers wrong value in create table context).

  mysql-test/r/func_math.result
    1.22 05/04/19 14:44:50 ramil@stripped +11 -0
    A fix (bug #9837: round(1, 6) delivers wrong value in create table context).

# 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/4.1.b9803

--- 1.238/sql/item_func.cc	2005-03-28 14:01:53 +05:00
+++ 1.239/sql/item_func.cc	2005-04-19 14:44:50 +05:00
@@ -1072,6 +1072,8 @@
       decimals=0;
     else
       decimals=min(tmp,NOT_FIXED_DEC);
+    if ((tmp= decimals - args[0]->decimals) > 0)
+      max_length+= tmp;
   }
 }
 

--- 1.21/mysql-test/r/func_math.result	2004-12-20 13:47:34 +04:00
+++ 1.22/mysql-test/r/func_math.result	2005-04-19 14:44:50 +05:00
@@ -1,3 +1,4 @@
+drop table if exists t1;
 select floor(5.5),floor(-5.5);
 floor(5.5)	floor(-5.5)
 5	-6
@@ -126,3 +127,13 @@
 Note	1003	select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)`
 select rand(rand);
 ERROR 42S22: Unknown column 'rand' in 'field list'
+create table t1 select round(1, 6);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `round(1, 6)` double(7,6) NOT NULL default '0.000000'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+round(1, 6)
+1.000000
+drop table t1;

--- 1.13/mysql-test/t/func_math.test	2004-12-20 13:47:34 +04:00
+++ 1.14/mysql-test/t/func_math.test	2005-04-19 14:44:50 +05:00
@@ -2,6 +2,10 @@
 # Test of math functions
 #
 
+--disable_warnings                                                              
+drop table if exists t1;                                                        
+--enable_warnings                                                               
+
 select floor(5.5),floor(-5.5);
 explain extended select floor(5.5),floor(-5.5);
 select ceiling(5.5),ceiling(-5.5);
@@ -58,3 +62,12 @@
 
 --error 1054
 select rand(rand);
+
+#
+# Bug #9837: problem with round()
+#
+
+create table t1 select round(1, 6);
+show create table t1;
+select * from t1;
+drop table t1;
Thread
bk commit into 4.1 tree (ramil:1.2197) BUG#9837ramil19 Apr