Bug #109897 Field_double::val_str causes string truncation
Submitted: 2 Feb 2023 10:08 Modified: 2 Feb 2023 11:27
Reporter: haizhen xue Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S3 (Non-critical)
Version:8.0.31 OS:Any
Assigned to: CPU Architecture:Any

[2 Feb 2023 10:08] haizhen xue
Description:
8.0.25:https://github.com/mysql/mysql-server/commit/43bd3f91537bd0525d29079a3ecc2a9a20e42317

mysql> create table t2(`double_col` double DEFAULT NULL);
Query OK, 0 rows affected (0.08 sec)
mysql> insert into t2 values(-2.2250738585072014e-308);
Query OK, 1 row affected (0.01 sec)

mysql> select rtrim(double_col) from t2 group by 1;
+-----------------------+
| rtrim(double_col)     |
+-----------------------+
| -2.2250738585072e-308 |
+-----------------------+
1 row in set (0.00 sec)

8.0.27:https://github.com/mysql/mysql-server/commit/c0fddf62e4963351fc08f914aad8f37b871fe1ab
mysql> create table t2(`double_col` double DEFAULT NULL);
Query OK, 0 rows affected (0.08 sec)
mysql> insert into t2 values(-2.2250738585072014e-308);
Query OK, 1 row affected (0.01 sec)

mysql> select rtrim(double_col) from t2 group by 1;
+------------------------+
| rtrim(double_col)      |
+------------------------+
| -2.2250738585072014e-3 |
+------------------------+
1 row in set (0.00 sec)

How to repeat:
mysql> create table t2(`double_col` double DEFAULT NULL);
Query OK, 0 rows affected (0.08 sec)
mysql> insert into t2 values(-2.2250738585072014e-308);
Query OK, 1 row affected (0.01 sec)

mysql> select rtrim(double_col) from t2 group by 1;
+------------------------+
| rtrim(double_col)      |
+------------------------+
| -2.2250738585072014e-3 |
+------------------------+
1 row in set (0.00 sec)
[2 Feb 2023 11:27] MySQL Verification Team
Hi,

Thank you for the report.