summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <gluh@mysql.com/gluh.(none)>2006-08-08 16:03:42 +0500
committerunknown <gluh@mysql.com/gluh.(none)>2006-08-08 16:03:42 +0500
commit66f6b5ba12ddfcd3c683e5a6df86b1d16751b1bf (patch)
tree475ca7e04f6aa86e1aaadb5b9381c3f76cb6cf95 /mysql-test/r
parentd406c600532766fbd80484d96a910c6836e13300 (diff)
downloadmariadb-git-66f6b5ba12ddfcd3c683e5a6df86b1d16751b1bf.tar.gz
Bug#16172 DECIMAL data type processed incorrectly
issue an 'overflow warning' if result value is bigger than max possible value include/decimal.h: Bug#16172 DECIMAL data type processed incorrectly new function decimal_intg() mysql-test/r/cast.result: Bug#16172 DECIMAL data type processed incorrectly result fix mysql-test/r/type_newdecimal.result: Bug#16172 DECIMAL data type processed incorrectly test result mysql-test/r/view.result: Bug#16172 DECIMAL data type processed incorrectly result fix mysql-test/t/type_newdecimal.test: Bug#16172 DECIMAL data type processed incorrectly test case sql/item_create.cc: Bug#16172 DECIMAL data type processed incorrectly do not increase decimal part on 2(according to manual) sql/my_decimal.h: Bug#16172 DECIMAL data type processed incorrectly new function my_decimal_intg() strings/decimal.c: Bug#16172 DECIMAL data type processed incorrectly new function decimal_intg()
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/cast.result8
-rw-r--r--mysql-test/r/type_newdecimal.result27
-rw-r--r--mysql-test/r/view.result2
3 files changed, 33 insertions, 4 deletions
diff --git a/mysql-test/r/cast.result b/mysql-test/r/cast.result
index 5e8f5dca711..eb2d83e7be4 100644
--- a/mysql-test/r/cast.result
+++ b/mysql-test/r/cast.result
@@ -103,7 +103,7 @@ Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'a'
select 10.0+cast('a' as decimal);
10.0+cast('a' as decimal)
-10.00
+10.0
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 'a'
select 10E+0+'a';
@@ -368,7 +368,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 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);
@@ -376,7 +378,7 @@ INSERT INTO t1 VALUES ('1.01', '2.02', '3.03', '4.04', '5.05');
SELECT CAST(v AS DECIMAL), CAST(tt AS DECIMAL), CAST(t AS DECIMAL),
CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
CAST(v AS DECIMAL) CAST(tt AS DECIMAL) CAST(t AS DECIMAL) CAST(mt AS DECIMAL) CAST(lt AS DECIMAL)
-1.01 2.02 3.03 4.04 5.05
+1 2 3 4 5
DROP TABLE t1;
select cast(NULL as decimal(6)) as t1;
t1
diff --git a/mysql-test/r/type_newdecimal.result b/mysql-test/r/type_newdecimal.result
index 9755083ab1c..95da4be6830 100644
--- a/mysql-test/r/type_newdecimal.result
+++ b/mysql-test/r/type_newdecimal.result
@@ -1418,3 +1418,30 @@ i2 count(distinct j)
1.0 2
2.0 2
drop table t1;
+select cast(143.481 as decimal(4,1));
+cast(143.481 as decimal(4,1))
+143.5
+select cast(143.481 as decimal(4,0));
+cast(143.481 as decimal(4,0))
+143
+select cast(143.481 as decimal(2,1));
+cast(143.481 as decimal(2,1))
+9.9
+Warnings:
+Error 1264 Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1
+select cast(-3.4 as decimal(2,1));
+cast(-3.4 as decimal(2,1))
+-3.4
+select cast(99.6 as decimal(2,0));
+cast(99.6 as decimal(2,0))
+99
+Warnings:
+Error 1264 Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1
+select cast(-13.4 as decimal(2,1));
+cast(-13.4 as decimal(2,1))
+-9.9
+Warnings:
+Error 1264 Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
+select cast(98.6 as decimal(2,0));
+cast(98.6 as decimal(2,0))
+99
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result
index 2de47f44556..4ef13a0f307 100644
--- a/mysql-test/r/view.result
+++ b/mysql-test/r/view.result
@@ -1787,7 +1787,7 @@ drop table t1;
create view v1 as select cast(1 as decimal);
select * from v1;
cast(1 as decimal)
-1.00
+1
drop view v1;
create table t1(f1 int);
create table t2(f2 int);