summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-05-09 17:27:14 +0500
committerunknown <holyfoot/hf@mysql.com/hfmain.(none)>2007-05-09 17:27:14 +0500
commit82b7c54338a3465790e4e64a647e82b9d7ea59b6 (patch)
tree21aa376a9aa5991c76af22780339740739f6451a /mysql-test/r
parent187ccf4bca5bf865fec86581d894fb8e6df0792a (diff)
downloadmariadb-git-82b7c54338a3465790e4e64a647e82b9d7ea59b6.tar.gz
Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect
Missing check for overflow added to the Item_decimal_typecast::val_decimal include/decimal.h: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect decimal_intg() declaration mysql-test/r/cast.result: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect result fixed mysql-test/r/type_newdecimal.result: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect test result mysql-test/t/type_newdecimal.test: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect test case added sql/item_func.cc: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect now we check for possible ovreflow in Item_decimal_typecast::val_decimal sql/my_decimal.h: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect my_decimal_intg() implemented strings/decimal.c: Bug #27957 cast as decimal does not check overflow, also inconsistent with group, subselect decimal_intg() implemented
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/cast.result4
-rw-r--r--mysql-test/r/type_newdecimal.result35
2 files changed, 38 insertions, 1 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 454a3766572..c0dab1c3293 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -378,7 +378,9 @@ create table t1(s1 time);
insert into t1 values ('11:11:11');
select cast(s1 as decimal(7,2)) from t1;
cast(s1 as decimal(7,2))
-111111.00
+99999.99
+Warnings:
+Error 1264 Out of range value adjusted for column 'cast(s1 as decimal(7,2))' at row 1
drop table t1;
CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
mt mediumtext, lt longtext);
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index c103de81bd7..cbcab126439 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1430,4 +1430,39 @@ select * from t1;
a
123456789012345678
drop table t1;
+select cast(11.1234 as DECIMAL(3,2));
+cast(11.1234 as DECIMAL(3,2))
+9.99
+Warnings:
+Error 1264 Out of range value adjusted for column 'cast(11.1234 as DECIMAL(3,2))' at row 1
+select * from (select cast(11.1234 as DECIMAL(3,2))) t;
+cast(11.1234 as DECIMAL(3,2))
+9.99
+Warnings:
+Error 1264 Out of range value adjusted for column 'cast(11.1234 as DECIMAL(3,2))' at row 1
+select cast(a as DECIMAL(3,2))
+from (select 11.1233 as a
+UNION select 11.1234
+UNION select 12.1234
+) t;
+cast(a as DECIMAL(3,2))
+9.99
+9.99
+9.99
+Warnings:
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+select cast(a as DECIMAL(3,2)), count(*)
+from (select 11.1233 as a
+UNION select 11.1234
+UNION select 12.1234
+) t group by 1;
+cast(a as DECIMAL(3,2)) count(*)
+9.99 3
+Warnings:
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
+Error 1264 Out of range value adjusted for column 'cast(a as DECIMAL(3,2))' at row 1
End of 5.0 tests