Below is the list of changes that have just been committed into a local
5.0 repository of igor. When igor 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@stripped, 2007-07-07 12:31:55-07:00, igor@stripped +3 -0
Fixed bug #29417.
An assertion abort could occur for some grouping queries that employed
decimal user variables with assignments to them.
The problem appeared the constructors of the class Field_new_decimal
because the function my_decimal_length_to_precision did not guarantee
returning decimal precision not greater than DECIMAL_MAX_PRECISION.
mysql-test/r/type_newdecimal.result@stripped, 2007-07-07 12:31:48-07:00, igor@stripped
+8 -0
Added a test case for bug #29417.
mysql-test/t/type_newdecimal.test@stripped, 2007-07-07 12:31:48-07:00, igor@stripped
+13 -0
Added a test case for bug #29417.
sql/field.cc@stripped, 2007-07-07 12:31:48-07:00, igor@stripped +2 -0
Fixed bug #29417.
An assertion abort could occur for some grouping queries that employed
decimal user variables with assignments to them.
The problem appeared the constructors of the class Field_new_decimal
because the function my_decimal_length_to_precision did not guarantee
returning decimal precision not greater than DECIMAL_MAX_PRECISION.
Now if the precision returned by calls to my_decimal_length_to_precision
in the constructors of the class Field_new_decimal is greater than
DECIMAL_MAX_PRECISION the precision is set to this value.
diff -Nrup a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
--- a/mysql-test/r/type_newdecimal.result 2007-05-21 10:28:19 -07:00
+++ b/mysql-test/r/type_newdecimal.result 2007-07-07 12:31:48 -07:00
@@ -1471,4 +1471,12 @@ drop table t1;
SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100)
b;
a b
0.9999999999999800000000000000 0.9999999999999800000000000000
+CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
+INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
+SET @a= CAST(1 AS decimal);
+SELECT 1 FROM t1 GROUP BY @b := @a, @b;
+1
+1
+1
+DROP TABLE t1;
End of 5.0 tests
diff -Nrup a/mysql-test/t/type_newdecimal.test b/mysql-test/t/type_newdecimal.test
--- a/mysql-test/t/type_newdecimal.test 2007-05-21 10:28:45 -07:00
+++ b/mysql-test/t/type_newdecimal.test 2007-07-07 12:31:48 -07:00
@@ -1162,4 +1162,17 @@ drop table t1;
#
SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100)
b;
+
+#
+# Bug #29417: assertion abort for a grouping query with decimal user variable
+#
+
+CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
+INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
+
+SET @a= CAST(1 AS decimal);
+SELECT 1 FROM t1 GROUP BY @b := @a, @b;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc 2007-06-15 07:56:29 -07:00
+++ b/sql/field.cc 2007-07-07 12:31:48 -07:00
@@ -2267,6 +2267,7 @@ Field_new_decimal::Field_new_decimal(cha
dec_arg, zero_arg, unsigned_arg)
{
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
+ set_if_smaller(precision, DECIMAL_MAX_PRECISION);
DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec);
@@ -2286,6 +2287,7 @@ Field_new_decimal::Field_new_decimal(uin
0, unsigned_arg)
{
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
+ set_if_smaller(precision, DECIMAL_MAX_PRECISION);
DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec);
| Thread |
|---|
| • bk commit into 5.0 tree (igor:1.2521) BUG#29417 | igor | 7 Jul |