python-mysql-replication icon indicating copy to clipboard operation
python-mysql-replication copied to clipboard

JSON partial updates make empty holes

Open rusuly opened this issue 5 years ago • 0 comments

Hi,

I'm working on a similar library for .NET and just wanted to share about some behavior that the library may have ignored. As described in JSON spec JSON partial updates may create empty spaces between keys and values. Some users experience the problem starting from MySQL 8.0.16

Steps to reproduce: UPDATE t1 SET JsonColumn='{"id": 1, "name": "Monica", "types":[1,"123"]}' WHERE Id = 1; UPDATE t1 SET JsonColumn = JSON_SET(JsonColumn, '$.name', 'Mon') WHERE id = 1;

In my lib I solved the problem by using the offsets and advancing the empty holes although not sure whether it's the correct solution

rusuly avatar Jan 31 '20 18:01 rusuly