pg_jsonpatch
PostgreSQL implementation of JSON Patch
pg_jsonpatch · PostgreSQL implementation of JSON Patch
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101565 | pg_jsonpatch | pg_jsonpatch | 1.0.0 | FUNC | MIT | SQL |
Usage
Sources:
- Official upstream README
- Official extension control file (pg_jsonpatch.control)
- Official extension SQL (pg_jsonpatch–1.0.0.sql)
pg_jsonpatch — I have not yet written tests for A.11-A.15 from the RFC. See ./test.sql for more examples. Use it when SQL needs these specialized functions or aggregates. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.
Core Workflow
Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.
Important Objects
jsonb_patch(target jsonb, patches jsonb)is an extension function and returnsjsonb.jsonb_patch_add(target jsonb, path text[], value jsonb)is an extension function and returnsjsonb.jsonb_patch_apply(target jsonb, patch jsonb)is an extension function and returnsjsonb.jsonb_patch_copy(target jsonb, _from text[], path text[])is an extension function and returnsjsonb.jsonb_patch_move(target jsonb, _from text[], path text[])is an extension function and returnsjsonb.jsonb_patch_remove(target jsonb, path text[])is an extension function and returnsjsonb.jsonb_patch_replace(target jsonb, path text[], value jsonb)is an extension function and returnsjsonb.jsonb_patch_split_path(path text)is an extension function and returnstext[].jsonb_patch_test(target jsonb, path text[], value jsonb)is an extension function and returnsjsonb.
Requirements and Caveats
- The reviewed control file declares default version
1.0.0. - The control file marks the extension as non-relocatable.
- The control file does not require superuser-only installation.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.