Skip to content

Partial document update based on JSON Patch #3166

@steve-chavez

Description

@steve-chavez

Problem

Currently there's no way to do a partial document update.

Solution

Use a vendored media type based on json patch where we support the operations we lack. As prior art, azure cosmosdb json patch (also see here) does a similar thing and adds support for increment and set, which are not defined in the JSON Patch RFC.

For starters, we can add support for increment. Like so:

PATCH /items?id=eq.1
Content-Type: application/vnd.pgrst.json-patch

[
  { "op": "incr", "path": "/inventory", "value": 10 },
]

Path would refer to any column and the generated SQL would be like UPDATE items SET inventory = inventory + 10.

Later on we can extend this to add other operations, like mult, div, concat, etc.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions