List:Internals« Previous MessageNext Message »
From:jani Date:May 10 2005 6:25am
Subject:bk commit into 5.0 tree (jani:1.1952) BUG#10232
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jani. When jani 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.1952 05/05/10 09:25:25 jani@stripped +3 -0
  Fixed Bug#10232: update with subquery, precision math,
  another column gets rotten value.

  strings/decimal.c
    1.50 05/05/10 09:25:22 jani@stripped +8 -1
    Fixed Bug#10232: update with subquery, precision math,
    another column gets rotten value.

  mysql-test/t/type_newdecimal.test
    1.10 05/05/10 09:25:22 jani@stripped +14 -0
    Added a test case for Bug#10232: update with subquery, precision math,
    another column gets rotten value.

  mysql-test/r/type_newdecimal.result
    1.11 05/05/10 09:25:22 jani@stripped +13 -0
    Added a test case for Bug#10232: update with subquery, precision math,
    another column gets rotten value.

# 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:	jani
# Host:	ibmlab.site
# Root:	/home/my/bk/mysql-5.0

--- 1.10/mysql-test/r/type_newdecimal.result	Sat May  7 12:51:59 2005
+++ 1.11/mysql-test/r/type_newdecimal.result	Tue May 10 09:25:22 2005
@@ -863,3 +863,16 @@
 select -0.123 * 0;
 -0.123 * 0
 0.000
+CREATE TABLE t1 (f1 DECIMAL (12,9), f2 DECIMAL(2,2));
+INSERT INTO t1 VALUES (10.5, 0);
+UPDATE t1 SET f1 = 4.5;
+SELECT * FROM t1;
+f1	f2
+4.500000000	0.00
+DROP TABLE t1;
+CREATE TABLE t1 (f1 DECIMAL (64,20), f2 DECIMAL(2,2));
+INSERT INTO t1 VALUES (9999999999999999999999999999999999, 0);
+SELECT * FROM t1;
+f1	f2
+9999999999999999999999999999999999.00000000000000000000	0.00
+DROP TABLE t1;

--- 1.9/mysql-test/t/type_newdecimal.test	Sat May  7 12:51:59 2005
+++ 1.10/mysql-test/t/type_newdecimal.test	Tue May 10 09:25:22 2005
@@ -892,3 +892,17 @@
 # Bug #9527
 #
 select -0.123 * 0;
+
+#
+# Bug #10232
+#
+
+CREATE TABLE t1 (f1 DECIMAL (12,9), f2 DECIMAL(2,2));
+INSERT INTO t1 VALUES (10.5, 0);
+UPDATE t1 SET f1 = 4.5;
+SELECT * FROM t1;
+DROP TABLE t1;
+CREATE TABLE t1 (f1 DECIMAL (64,20), f2 DECIMAL(2,2));
+INSERT INTO t1 VALUES (9999999999999999999999999999999999, 0);
+SELECT * FROM t1;
+DROP TABLE t1;

--- 1.49/strings/decimal.c	Sat May  7 12:40:23 2005
+++ 1.50/strings/decimal.c	Tue May 10 09:25:22 2005
@@ -1162,6 +1162,8 @@
       isize0=intg0*sizeof(dec1)+dig2bytes[intg0x],
       fsize0=frac0*sizeof(dec1)+dig2bytes[frac0x],
       fsize1=frac1*sizeof(dec1)+dig2bytes[frac1x];
+  const int orig_isize0= isize0;
+  const int orig_fsize0= fsize0;
   char *orig_to= to;
 
   buf1= remove_leading_zeroes(from, &from_intg);
@@ -1252,10 +1254,15 @@
   }
   if (fsize0 > fsize1)
   {
-    while (fsize0-- > fsize1)
+    char *to_end= orig_to + orig_fsize0 + orig_isize0;
+
+    while (fsize0-- > fsize1 && to < to_end)
       *to++=(uchar)mask;
   }
   orig_to[0]^= 0x80;
+
+  /* Check that we have written the whole decimal and nothing more */
+  DBUG_ASSERT(to == orig_to + orig_fsize0 + orig_isize0);
   return error;
 }
 
Thread
bk commit into 5.0 tree (jani:1.1952) BUG#10232jani10 May