tidb-challenge-program / bug-hunting-issue

Bug hunting issues.
3 stars 0 forks source link

P2-[4.0 Bug Hunting]-[Inconsistent error code]-inserting big values #83

Open zhangysh1995 opened 4 years ago

zhangysh1995 commented 4 years ago

Bug Report

1. What did you do?

create table tt1 (c1 decimal(64));
insert into tt1 values( 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 );
insert into tt1 values( 89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000 );
insert into tt1 values( 65000000000000000000000000000000000000000000000000000000000000000 );
insert into tt1 values( 65123456789012345678901234567890123456789012345678901234567890000 );
insert into tt1 values( 6412345678901234567890123456789012345678901234567890123456789000 );
insert into tt1 values(  6.4123456E63 );

2. What did you expect to see?

mysql> create table tt1 (c1 decimal(64));                                                                                                                                                                                                                             Query OK, 0 rows affected (0.02 sec)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        mysql> insert into tt1 values( 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 );                                                                                                                                           
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000 );
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 65000000000000000000000000000000000000000000000000000000000000000 );
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 65123456789012345678901234567890123456789012345678901234567890000 );
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 6412345678901234567890123456789012345678901234567890123456789000 );
Query OK, 1 row affected (0.00 sec)

mysql> insert into tt1 values(  6.4123456E63 );
Query OK, 1 row affected (0.00 sec)

3. What did you see instead?

mysql> insert into tt1 values( 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 113 near "89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 )"decimal literal: [types:1690]%s value is out of range in '%s' 
mysql> insert into tt1 values( 89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000 );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 113 near "89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000 )"decimal literal: [types:1690]%s value is out of range in '%s' 
mysql> insert into tt1 values( 65000000000000000000000000000000000000000000000000000000000000000 );
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 65123456789012345678901234567890123456789012345678901234567890000 );
ERROR 1264 (22003): Out of range value for column 'c1' at row 1
mysql> insert into tt1 values( 6412345678901234567890123456789012345678901234567890123456789000 );
Query OK, 1 row affected (0.00 sec)

mysql> insert into tt1 values(  6.4123456E63 );
Query OK, 1 row affected (0.00 sec)

4. What version of TiDB are you using? (tidb-server -V or run select tidb_version(); on TiDB)

commit 0d33a845766733fbb9e40dae8b7bf38fb0d3498b (HEAD -> master, origin/master, origin/HEAD)                                                                                                                                                                          
Author: Zhuomin(Charming) Liu <lzmhhh123@gmail.com>                                                                                                                                                                                                                   
Date:   Wed May 20 19:54:37 2020 +0800   
mysql> select tidb_version();                                                                                                +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+              | tidb_version()                                                                                                                                                                                                                           |              +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: None
Edition: None
Git Commit Hash: None
Git Branch: None
UTC Build Time: None
GoVersion: go1.13.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
zhangysh1995 commented 4 years ago

Another similar case:

mysql> select  CAST(1.0E+300 AS   DECIMAL);
ERROR 1690 (22003): %s value is out of range in '%s'

mysql> select  CAST(1.0E+3000000 AS   DECIMAL);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 25 near "1.0E+3000000 AS   DECIMAL)"float literal: strconv.ParseFloat: parsing "1.0E+3000000": value out of range 

mysql> select  CAST(1.0E+300000000000 AS   DECIMAL);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 30 near "1.0E+300000000000 AS   DECIMAL)"float literal: strconv.ParseFloat: parsing "1.0E+300000000000": value out of range 

mysql> select  CAST(1.0E+300000000000000000 AS   DECIMAL);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 36 near "1.0E+300000000000000000 AS   DECIMAL)"float literal: strconv.ParseFloat: parsing "1.0E+300000000000000000": value out of range 
shuke987 commented 4 years ago

/bug P2