julien-duponchelle / julien-duponchelle/python-mysql-replication
JSON partial updates make empty holes
- Dominant language
- Python
- Stars
- 2.4k
- Forks
- 690
- PR merge metrics
- No merged PRs in 30d
Description
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](https://dev.mysql.com/worklog/task/?id=8132#tabs-8132-4) JSON partial updates may create empty spaces between keys and values. Some users experience the problem starting from [MySQL 8.0.16](https://github.com/shyiko/mysql-binlog-connector-java/pull/288)
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
Contributor guide
Assessment
This issue has not been assessed yet.