Home > Blockchain >  MySql. 1292 Truncated incorrect DECIMAL value:
MySql. 1292 Truncated incorrect DECIMAL value:

Time:05-10

Mysql 5.7. I have this code in existing (legacy) project:

UPDATE IGNORE someTable` SET `_bigInteger` = IF(CAST(`bigInteger` AS DECIMAL(65,0)) IS NULL, NULL, JSON_ARRAY(CAST(`bigInteger` AS DECIMAL(65,0))));

Please don't ask what the point of "IF" statement here. If the table has some big integer value, like 432846738962985239845762942343875692386, this update generate the warning:

1 row(s) affected, 1 warning(s): 1292 Truncated incorrect DECIMAL value: '432846738962985239845762942343875692386' Rows matched: 1  Changed: 1  Warnings: 1

And as result my stored value looks like this: [4.328467389629851e38], which is bad. I need to have this entire value [432846738962985239845762942343875692386].

Why do I have this warning and this cut?

CodePudding user response:

Perhaps this is it I somehow encountered

https://bugs.mysql.com/bug.php?id=39079

CodePudding user response:

Important adding - Mysql 5.7. Looks like everything works in 8.0

  • Related