Loading mysql-test/r/type_newdecimal.result +8 −0 Original line number Diff line number Diff line Loading @@ -1491,4 +1491,12 @@ aa SUM(b) SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. DROP TABLE t1; 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 mysql-test/t/type_newdecimal.test +12 −0 Original line number Diff line number Diff line Loading @@ -1183,6 +1183,18 @@ 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 sql/field.cc +2 −0 Original line number Diff line number Diff line Loading @@ -2267,6 +2267,7 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg, 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); Loading @@ -2286,6 +2287,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg, 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); Loading Loading
mysql-test/r/type_newdecimal.result +8 −0 Original line number Diff line number Diff line Loading @@ -1491,4 +1491,12 @@ aa SUM(b) SELECT a+CAST(1 AS decimal(65,31)) AS aa, SUM(b) FROM t1 GROUP BY aa; ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. DROP TABLE t1; 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
mysql-test/t/type_newdecimal.test +12 −0 Original line number Diff line number Diff line Loading @@ -1183,6 +1183,18 @@ 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
sql/field.cc +2 −0 Original line number Diff line number Diff line Loading @@ -2267,6 +2267,7 @@ Field_new_decimal::Field_new_decimal(char *ptr_arg, 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); Loading @@ -2286,6 +2287,7 @@ Field_new_decimal::Field_new_decimal(uint32 len_arg, 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); Loading