diff options
author | unknown <igor@olga.mysql.com> | 2007-07-07 10:33:02 -0700 |
---|---|---|
committer | unknown <igor@olga.mysql.com> | 2007-07-07 10:33:02 -0700 |
commit | 3756819e4bd548f4fd6ac8773697768435dbd129 (patch) | |
tree | 198e5aba09467140997eca3bd0a0a88d7db60b8c /mysql-test/r/type_newdecimal.result | |
parent | 8195a213c2fadfb185e755ce6dda2162df1a5529 (diff) | |
download | mariadb-git-3756819e4bd548f4fd6ac8773697768435dbd129.tar.gz |
Fixed bug #29415.
The cast operation ignored the cases when the precision and/or the scale exceeded
the limits, 65 and 30 respectively. No errors were reported in these cases.
For some queries this may lead to an assertion abort.
Fixed by throwing errors for such cases.
mysql-test/r/type_newdecimal.result:
Added a test case for bug #29415.
mysql-test/t/type_newdecimal.test:
Added a test case for bug #29415.
Diffstat (limited to 'mysql-test/r/type_newdecimal.result')
-rw-r--r-- | mysql-test/r/type_newdecimal.result | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result index 9e165721033..d858c3cbdd6 100644 --- a/mysql-test/r/type_newdecimal.result +++ b/mysql-test/r/type_newdecimal.result @@ -1471,4 +1471,24 @@ drop table t1; SELECT 1.000000000000 * 99.999999999998 / 100 a,1.000000000000 * (99.999999999998 / 100) b; a b 0.9999999999999800000000000000 0.9999999999999800000000000000 +SELECT CAST(1 AS decimal(65,10)); +CAST(1 AS decimal(65,10)) +1.0000000000 +SELECT CAST(1 AS decimal(66,10)); +ERROR 42000: Too big precision 66 specified for column '1'. Maximum is 65. +SELECT CAST(1 AS decimal(65,30)); +CAST(1 AS decimal(65,30)) +1.000000000000000000000000000000 +SELECT CAST(1 AS decimal(65,31)); +ERROR 42000: Too big scale 31 specified for column '1'. Maximum is 30. +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; +aa SUM(b) +2.000000000000000000000000000000 10 +3.000000000000000000000000000000 10 +4.000000000000000000000000000000 30 +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; End of 5.0 tests |