List:Commits« Previous MessageNext Message »
From:ramil Date:March 7 2006 2:10pm
Subject:bk commit into 5.1 tree (ramil:1.2161) BUG#18014
View as plain text  
Below is the list of changes that have just been committed into a local
5.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.2161 06/03/07 17:10:25 ramil@stripped +4 -0
  Fix for bug #18014: data loss caused by altering decimal fields.

  sql/field.h
    1.181 06/03/07 17:10:16 ramil@stripped +1 -0
    Fix for bug #18014: data loss caused by altering decimal fields.
    - Field_new_decimal::is_equal() introduced for proper comparisons of the decimal field
definitions.

  sql/field.cc
    1.304 06/03/07 17:10:16 ramil@stripped +12 -0
    Fix for bug #18014: data loss caused by altering decimal fields.
    - Field_new_decimal::is_equal() introduced for proper comparisons of the decimal field
definitions.

  mysql-test/t/type_newdecimal.test
    1.36 06/03/07 17:10:16 ramil@stripped +11 -0
    Fix for bug #18014: data loss caused by altering decimal fields.

  mysql-test/r/type_newdecimal.result
    1.41 06/03/07 17:10:15 ramil@stripped +10 -0
    Fix for bug #18014: data loss caused by altering decimal fields.

# 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:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/mysql-5.1-new

--- 1.303/sql/field.cc	2006-02-27 19:58:32 +04:00
+++ 1.304/sql/field.cc	2006-03-07 17:10:16 +04:00
@@ -2578,6 +2578,18 @@ void Field_new_decimal::sql_type(String 
 }
 
 
+uint Field_new_decimal::is_equal(create_field *new_field)
+{
+  return ((new_field->sql_type == type()) &&
+          ((new_field->flags & UNSIGNED_FLAG) ==
+           (uint) (flags & UNSIGNED_FLAG)) &&
+          ((new_field->flags & AUTO_INCREMENT_FLAG) ==
+           (uint) (flags & AUTO_INCREMENT_FLAG)) &&
+          (new_field->length == max_length()) && 
+          (new_field->decimals == dec));
+}
+
+
 /****************************************************************************
 ** tiny int
 ****************************************************************************/

--- 1.180/sql/field.h	2006-03-01 13:16:09 +04:00
+++ 1.181/sql/field.h	2006-03-07 17:10:16 +04:00
@@ -513,6 +513,7 @@ public:
   uint32 max_length() { return field_length; }
   uint size_of() const { return sizeof(*this); } 
   uint32 pack_length() const { return (uint32) bin_size; }
+  uint is_equal(create_field *new_field);
 };
 
 

--- 1.40/mysql-test/r/type_newdecimal.result	2006-02-22 13:09:52 +04:00
+++ 1.41/mysql-test/r/type_newdecimal.result	2006-03-07 17:10:15 +04:00
@@ -1397,3 +1397,13 @@ c1
 9999999999999999999999999999999999999999999999999999999999999999
 9999999999999999999999999999999999999999999999999999999999999999
 drop table t1;
+create table t1(a decimal(7,2));
+insert into t1 values(123.12);
+select * from t1;
+a
+123.12
+alter table t1 modify a decimal(10,2);
+select * from t1;
+a
+123.12
+drop table t1;

--- 1.35/mysql-test/t/type_newdecimal.test	2005-11-29 16:58:25 +04:00
+++ 1.36/mysql-test/t/type_newdecimal.test	2006-03-07 17:10:16 +04:00
@@ -1085,3 +1085,14 @@ insert into t1 values(
 insert into t1 values(1e100);
 select * from t1;
 drop table t1;
+
+#
+# Bug #18014: problem with 'alter table'
+#
+
+create table t1(a decimal(7,2));                                              
+insert into t1 values(123.12);                                                 
+select * from t1;                                                              
+alter table t1 modify a decimal(10,2);                                         
+select * from t1;                                                              
+drop table t1;
Thread
bk commit into 5.1 tree (ramil:1.2161) BUG#18014ramil7 Mar