jsonb_delta
jsonb_delta · JSONB changesets, keyed array updates and merge functions.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102311 | jsonb_delta | jsonb_delta | 0.3.2 | FUNC | PostgreSQL | Rust |
PostgreSQL · 14, 15, 16, 17, 18
Usage
Sources:
jsonb_delta 0.3.2 provides JSONB changesets, keyed array edits and merge helpers. Functions return new JSONB values; persisting a result still uses an ordinary PostgreSQL row update and MVCC.
Core Workflow
Enable the installed extension and update an array element by its key:
The result contains the updated order. Use the returned value in an UPDATE expression when the change should persist; a standalone SELECT does not modify a stored document.
Main Functions
jsonb_apply_changeset(doc, ops)applies an ordered JSONB array of edits. Supported operations include set, remove, merge, increment and array edits; paths accept strings or arrays of segments.jsonb_array_update_whereandjsonb_array_delete_wherematch an element by key and JSONB value.jsonb_array_contains_idtests membership;jsonb_array_insert_wheresupports sorted insertion.jsonb_array_update_where_batchgroups edits for one document;jsonb_array_update_multi_rowaccepts an array of documents and returns a set of results.jsonb_smart_patch_scalar,jsonb_smart_patch_nestedandjsonb_smart_patch_arraymerge at different scopes.jsonb_merge_shallowandjsonb_merge_at_pathprovide explicit merge helpers.jsonb_extract_idpreserves numeric precision when extracting an identifier.
Compatibility and Boundaries
Version 0.3.x requires PostgreSQL 14–18: the changelog explicitly drops PostgreSQL 13 despite a stale README badge and Cargo feature. No shared preload or restart is required for ordinary use. The control file sets superuser to false but does not mark the extension trusted; its SQL creates C-language functions, so installation still needs the corresponding privileges.
The extension is not relocatable. Most transformation functions are immutable, strict and parallel safe; check the versioned SQL for each signature, especially optional arguments. Changesets are limited to 10,000 operations and paths to 1,000 segments; integer increment overflow raises an error.
Version 0.3.0 corrected numeric-value matching, text/UUID batch keys and identifier precision. Version 0.3.2 adds a PostgreSQL 18 release build. Its SQL upgrade advances the version label and preserves the 0.3.1 function signatures and behavior. Earlier installations have an upgrade chain through 0.2.0 and 0.3.0. Install matching binaries before applying the SQL upgrade, and replace sessions that have loaded an older library.