Commit e06c6744 authored by igor@olga.mysql.com's avatar igor@olga.mysql.com

Merge olga.mysql.com:/home/igor/mysql-5.0-opt

into  olga.mysql.com:/home/igor/dev-opt/mysql-5.1-opt
parents e657075f e1eababb
...@@ -1172,6 +1172,39 @@ drop table t1; ...@@ -1172,6 +1172,39 @@ drop table t1;
# #
SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b;
#
# Bug #29415: CAST AS DECIMAL(P,S) with too big precision/scale
#
SELECT CAST(1 AS decimal(65,10));
--error ER_TOO_BIG_PRECISION
SELECT CAST(1 AS decimal(66,10));
SELECT CAST(1 AS decimal(65,30));
--error ER_TOO_BIG_SCALE
SELECT CAST(1 AS decimal(65,31));
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
--error ER_TOO_BIG_SCALE
SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa;
DROP TABLE t1;
#
# 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 --echo End of 5.0 tests
# #
......
...@@ -2316,6 +2316,7 @@ Field_new_decimal::Field_new_decimal(uchar *ptr_arg, ...@@ -2316,6 +2316,7 @@ Field_new_decimal::Field_new_decimal(uchar *ptr_arg,
unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg)
{ {
precision= my_decimal_length_to_precision(len_arg, dec_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) && DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE)); (dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec); bin_size= my_decimal_get_binary_size(precision, dec);
...@@ -2332,6 +2333,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg, ...@@ -2332,6 +2333,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg,
NONE, name, dec_arg, 0, unsigned_arg) NONE, name, dec_arg, 0, unsigned_arg)
{ {
precision= my_decimal_length_to_precision(len_arg, dec_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) && DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE)); (dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec); bin_size= my_decimal_get_binary_size(precision, dec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment