| Bug #114740 | mysql lost decimal's precision for json data type. | ||
|---|---|---|---|
| Submitted: | 23 Apr 2024 8:29 | Modified: | 25 Apr 2024 7:41 |
| Reporter: | biao li | Email Updates: | |
| Status: | Duplicate | Impact on me: | |
| Category: | MySQL Server: JSON | Severity: | S4 (Feature request) |
| Version: | 8.0.36 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | decimal, json | ||
[23 Apr 2024 8:46]
MySQL Verification Team
Hello biao li, Thank you for the enhancement request! regards, Umesh
[25 Apr 2024 7:41]
Knut Anders Hatlen
This looks like the same issue that is described in bug#83954. Closing as duplicate. Thanks.

Description: mysqld may lose decimal's precision in json's datatype. mysqld use rapidjson to parse string json, however, rapidjson may lose precision when it try to parse a mysql decimal type with c++'s double. mysql> create database w1; Query OK, 1 row affected (0.01 sec) mysql> use w1; Database changed mysql> create table t1(id int, name json); Query OK, 0 rows affected (0.33 sec) mysql> insert into t1 values(1,'{"a":-99999999999999999999999999999999999.999999999999999999999999999998}'); Query OK, 1 row affected (0.11 sec) mysql> select * from t1; +------+--------------+ | id | name | +------+--------------+ | 1 | {"a": -1e35} | +------+--------------+ 1 row in set (0.00 sec) How to repeat: create database w1; use w1; create table t1(id int, name json); insert into t1 values(1,'{"a":-99999999999999999999999999999999999.999999999999999999999999999998}'); select * from t1; Suggested fix: Should support all mysql's datatype in JSON.