Skip to content

JSON partial updates make empty holes #310

Open
@rusuly

Description

@rusuly

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions