From: Sergey Glukhov Date: May 26 2011 10:13am Subject: bzr push into mysql-5.1 branch (sergey.glukhov:3628 to 3629) Bug#12392636 List-Archive: http://lists.mysql.com/commits/138176 X-Bug: 12392636 Message-Id: <201105261021.p4QALdho023950@acsmt356.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3629 Sergey Glukhov 2011-05-26 Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION Assertion happens due to missing NULL value check in Item_func_round::fix_length_and_dec() function. The fix: added NULL value check for second parameter. @ mysql-test/r/func_math.result test case @ mysql-test/t/func_math.test test case @ sql/item_func.cc added NULL value check for second parameter. modified: mysql-test/r/func_math.result mysql-test/t/func_math.test sql/item_func.cc 3628 Anitha Gopi 2011-05-24 BUG#12371924 # Bug is fixed. Move test out of experimental group modified: mysql-test/collections/default.experimental === modified file 'mysql-test/r/func_math.result' --- a/mysql-test/r/func_math.result 2011-04-20 07:39:20 +0000 +++ b/mysql-test/r/func_math.result 2011-05-26 10:06:39 +0000 @@ -540,4 +540,10 @@ ROUND(LEAST(15, -4939092, 0.2704), STDDE -4939092.0000 Warnings: Warning 1292 Truncated incorrect DOUBLE value: 'a' +# +# Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION +# +SELECT SUM(DISTINCT (TRUNCATE((.1), NULL))); +SUM(DISTINCT (TRUNCATE((.1), NULL))) +NULL End of 5.1 tests === modified file 'mysql-test/t/func_math.test' --- a/mysql-test/t/func_math.test 2011-04-20 07:39:20 +0000 +++ b/mysql-test/t/func_math.test 2011-05-26 10:06:39 +0000 @@ -349,4 +349,10 @@ DROP TABLE t1; SELECT ROUND(LEAST(15, -4939092, 0.2704), STDDEV('a')); +--echo # +--echo # Bug#12392636 ASSERTION FAILED: SCALE >= 0 && PRECISION > 0 && SCALE <= PRECISION +--echo # + +SELECT SUM(DISTINCT (TRUNCATE((.1), NULL))); + --echo End of 5.1 tests === modified file 'sql/item_func.cc' --- a/sql/item_func.cc 2011-05-16 20:04:01 +0000 +++ b/sql/item_func.cc 2011-05-26 10:06:39 +0000 @@ -1972,6 +1972,9 @@ void Item_func_round::fix_length_and_dec } val1= args[1]->val_int(); + if ((null_value= args[1]->is_null())) + return; + val1_unsigned= args[1]->unsigned_flag; if (val1 < 0) decimals_to_set= val1_unsigned ? INT_MAX : 0; No bundle (reason: useless for push emails).