Bug #93010 | JSON_SET() does not create intermediate objects | ||
---|---|---|---|
Submitted: | 30 Oct 2018 14:40 | Modified: | 30 Oct 2018 20:22 |
Reporter: | Alfredo Kojima | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: JSON | Severity: | S3 (Non-critical) |
Version: | 8.0.13 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[30 Oct 2018 14:40]
Alfredo Kojima
[30 Oct 2018 14:42]
Alfredo Kojima
A workaround is to use JSON_MERGE_PATCH() instead of JSON_SET(): mysql> select json_merge_patch(cast('{}' as json), cast('{"a":{"b":42}}' as json)); +----------------------------------------------------------------------+ | json_merge_patch(cast('{}' as json), cast('{"a":{"b":42}}' as json)) | +----------------------------------------------------------------------+ | {"a": {"b": 42}} | +----------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> select json_merge_patch(cast('{"a":"hello"}' as json), cast('{"a":{"b":42}}' as json)); +---------------------------------------------------------------------------------+ | json_merge_patch(cast('{"a":"hello"}' as json), cast('{"a":{"b":42}}' as json)) | +---------------------------------------------------------------------------------+ | {"a": {"b": 42}} | +---------------------------------------------------------------------------------+ 1 row in set (0.00 sec)