Bug #92066 MySQL Workbench JSON Editor Transform Big Numbers To Negative Numbers
Submitted: 19 Aug 2018 21:24 Modified: 20 Aug 2018 4:10
Reporter: Shay Cohen Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Workbench: SQL Editor Severity:S2 (Serious)
Version:8.0.12 OS:Windows
Assigned to: CPU Architecture:Any
Tags: editor, json

[19 Aug 2018 21:24] Shay Cohen
Description:
When opening a json column value by "Open Value in Editor" and going to the JSON tab, large numbers becoming negative. When applying the editor changes you can see in the command output it truly changes.

How to repeat:
Run the following script from MYSQL Workbench query tab (After connecting to a mysql):
CREATE SCHEMA `example` DEFAULT CHARACTER SET utf8 ;

CREATE TABLE `example`.`example_table` (
  `id` INT NOT NULL,
  `value` JSON NOT NULL,
  PRIMARY KEY (`id`));
  
  
INSERT INTO `example`.`example_table` (`id`,`value`) VALUES(1, "{\"number\":999999999999999999999}");

SELECT * FROM `example`.`example_table`;

Right click on the value result of the query.
Choose "Open Value in Editor".
Go to the "JSON" tab.
You will see:
{
	"number" : -9223372036854775808
}

Also applying from the editor will result with the following command:
UPDATE `example`.`example_table` SET `value`='{\n	\"number\" : -9223372036854775808\n}' WHERE `id`='1';

Suggested fix:
I reported the same bug but with a smaller number in
https://bugs.mysql.com/bug.php?id=87646

I guess the answer is somewhere in the solution of this issue.
[20 Aug 2018 4:10] MySQL Verification Team
Hello Shay Cohen,

Thank you for the report and test case.
Verified as described using WB 8.0.12 on Win7.

regards,
Umesh