mysql JSON_SET can't insert into column with NULL value(5.7+) mysql JSON_SET can't insert into column with NULL value(5.7+) mysql mysql

mysql JSON_SET can't insert into column with NULL value(5.7+)


Use COALESCE:

UPDATE testjson SET extra = JSON_SET(COALESCE(extra, '{}'), '$.age', 87);


SET extra = JSON_SET(IFNULL(extra, "{}"), "$.age", 87)