Bug #83954 JSON handeling of DECIMAL values, JSON from JSON string
Submitted: 24 Nov 2016 12:42 Modified: 1 Dec 2016 13:32
Reporter: sinai yoktan Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: JSON Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[24 Nov 2016 12:42] sinai yoktan
it seems that mysql is inconsistent when handeling / displaying bug decimal values in the context of JSON object.

JSON will encode big DECIMAL values as floating point number in some cases, and not in others,

this appears to happen when MySQL process the JSON object as a string.

MySQL often converts JSON objects to string implicitly
and might cause unexpected behavior.
this might also be caused by the users explicitly (casting JSON to TEXT and vice versa) however without knowledge of the expected effect

no warning is issued on the conversion (might setting dependent though).

How to repeat:
@j0 := JSON_OBJECT('a',123456789012345678901234567890) json_object_,
CAST(CAST(JSON_OBJECT('a',123456789012345678901234567890) AS CHAR) AS JSON) json_object_from_char_,
CAST(@j0 AS JSON) json_object_from_variable_,
JSON_EXTRACT(JSON_OBJECT('a',123456789012345678901234567890),'$.a') json_value_,
JSON_EXTRACT(@j0,'$.a') json_value_from_variable
[1 Dec 2016 13:32] Chiranjeevi Battula
Hello sinai yoktan,

Thank you for the bug report.
Verified based on internal discussion with dev's.