diff options
author | monty@hundin.mysql.fi <> | 2002-05-02 18:04:21 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2002-05-02 18:04:21 +0300 |
commit | e90c6b481ddca05e9be84b43486e3ef507fa3021 (patch) | |
tree | e3f51e58cf724cef14bef4aa47370a62fd4d6bdf /mysql-test | |
parent | 0b6a7865409afc946e9b8ab9c4e4dfd288326699 (diff) | |
download | mariadb-git-e90c6b481ddca05e9be84b43486e3ef507fa3021.tar.gz |
Fixed problems with DECIMAL() type on overflow.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/type_decimal.result | 108 | ||||
-rw-r--r-- | mysql-test/t/type_decimal.test | 64 |
2 files changed, 172 insertions, 0 deletions
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result index 0877424648b..82b7d155822 100644 --- a/mysql-test/r/type_decimal.result +++ b/mysql-test/r/type_decimal.result @@ -3,3 +3,111 @@ id datatype_id minvalue maxvalue valuename forecolor backcolor 146 16 0.0000000000 1.9000000000 0 16769024 id datatype_id minvalue maxvalue valuename forecolor backcolor 143 16 -4.9000000000 -0.1000000000 NULL 15774720 +a +0.00 +-0.00 ++0.00 +01.00 ++01.00 +-01.00 +-0.10 ++0.10 +0.10 +000000001.00 ++00000001.00 +-00000001.00 +111111111.11 +111111111.11 +-11111111.11 +-99999999.99 +999999999.99 +999999999.99 +a +0.00 +0.00 +0.00 +01.00 +01.00 +0.00 +0.00 +0.10 +0.10 +00000001.00 +00000001.00 +0.00 +99999999.99 +99999999.99 +0.00 +0.00 +99999999.99 +99999999.99 +a +00000000.00 +00000000.00 +00000000.00 +00000001.00 +00000001.00 +00000000.00 +00000000.00 +00000000.10 +00000000.10 +00000001.00 +00000001.00 +00000000.00 +99999999.99 +99999999.99 +00000000.00 +00000000.00 +99999999.99 +99999999.99 +a +0.00 +-0.00 +0.00 +1.00 +1.00 +-1.00 +-0.10 +0.10 +0.10 +1.00 +1.00 +-1.00 +111111111.11 +111111111.11 +-11111111.11 +-99999999.99 +999999999.99 +999999999.99 +a +-9999999999 +-1 ++1 +01 ++0000000001 +12345678901 +99999999999 +a +0 +0 +1 +01 +0000000001 +1234567890 +9999999999 +a +0000000000 +0000000000 +0000000001 +0000000001 +0000000001 +1234567890 +9999999999 +a +0000000000 +0000000000 +0000000001 +0000000001 +0000000001 +1234567890 +9999999999 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; |