summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-05-02 18:04:21 +0300
committerunknown <monty@hundin.mysql.fi>2002-05-02 18:04:21 +0300
commit23bf3689667890dd8da518b6478f10090a5adaf4 (patch)
treee3f51e58cf724cef14bef4aa47370a62fd4d6bdf /mysql-test/t
parentc3703e5568c76669c8277e98206a00e6f652b5fd (diff)
downloadmariadb-git-23bf3689667890dd8da518b6478f10090a5adaf4.tar.gz
Fixed problems with DECIMAL() type on overflow.
Docs/manual.texi: Changlog configure.in: Change to version 3.23.51 Fix for OSF1 include/mysqld_error.h: Added copyright message isam/pack_isam.c: Added copyright message mysql-test/r/type_decimal.result: New test results mysql-test/t/type_decimal.test: New test results strings/Makefile.am: Added mising file
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/type_decimal.test64
1 files changed, 64 insertions, 0 deletions
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 8d4b50eec4d..70b30d455da 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -147,3 +147,67 @@ INSERT INTO t1 VALUES ( '146', '16', '0.0000000000', '1.9000000000', '', '0', '1
select * from t1 where minvalue<=1 and maxvalue>=-1 and datatype_id=16;
select * from t1 where minvalue<=-1 and maxvalue>=-1 and datatype_id=16;
drop table t1;
+
+#
+# Test of correct handling leading zero and +/- signs
+# then values are passed as strings
+# Also test overflow handling in this case
+#
+
+create table t1 (a decimal(10,2));
+insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
+insert into t1 values ("-.1"),("+.1"),(".1");
+insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
+insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+select * from t1;
+drop table t1;
+
+create table t1 (a decimal(10,2) unsigned);
+insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
+insert into t1 values ("-.1"),("+.1"),(".1");
+insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
+insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+select * from t1;
+drop table t1;
+
+create table t1 (a decimal(10,2) zerofill);
+insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
+insert into t1 values ("-.1"),("+.1"),(".1");
+insert into t1 values ("00000000000001"),("+0000000000001"),("-0000000000001");
+insert into t1 values ("+111111111.11"),("111111111.11"),("-11111111.11");
+insert into t1 values ("-111111111.11"),("+1111111111.11"),("1111111111.11");
+select * from t1;
+drop table t1;
+
+
+create table t1 (a decimal(10,2));
+insert into t1 values (0.0),(-0.0),(+0.0),(01.0),(+01.0),(-01.0);
+insert into t1 values (-.1),(+.1),(.1);
+insert into t1 values (00000000000001),(+0000000000001),(-0000000000001);
+insert into t1 values (+111111111.11),(111111111.11),(-11111111.11);
+insert into t1 values (-111111111.11),(+1111111111.11),(1111111111.11);
+select * from t1;
+drop table t1;
+
+#
+# Test correct handling of overflowed decimal values
+#
+
+create table t1 (a decimal);
+insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
+select * from t1;
+drop table t1;
+create table t1 (a decimal unsigned);
+insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+select * from t1;
+drop table t1;
+create table t1 (a decimal zerofill);
+insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+select * from t1;
+drop table t1;
+create table t1 (a decimal unsigned zerofill);
+insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+1234567890'),(99999999999999);
+select * from t1;
+drop table t1;