jsonb_extra
jsonb_extra · Extra JSONB functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100597 | jsonb_extra | jsonb_extra | 1.0 | FUNC | Unknown | C |
Usage
Sources:
jsonb_extra 1.0 is a small C extension that extracts every JSON value reached by a key path, converts JSON scalars to text, and replaces an existing nested value. It predates much of PostgreSQL’s current JSON-path surface and should be evaluated as experimental code.
Core Workflow
jsonb_extract walks object keys and fans out across arrays encountered on the path, returning a jsonb[]. jsonb_extract_text performs the same traversal and returns a text[]. Both return null when the path produces no values.
Important Objects
jsonb_extract(jsonb, text[])returns all matching values as JSONB elements.jsonb_extract_text(jsonb, text[])returns all matching values converted to text.jsonb_as_text(jsonb)converts a top-level scalar to text; JSON null becomes an empty string, and containers use JSON text representation.jsonb_update(jsonb, text[], jsonb)replaces a value at an existing object path and returns the rebuilt document.
Operational Notes
All four functions are strict and immutable. The implementation explicitly marks path creation and array updates as unfinished, so jsonb_update should only be used for existing object paths. The source also contains unresolved memory-safety comments around JSONB value handling. Test malformed, missing, nested-array, and large-document cases on the exact PostgreSQL build, and prefer PostgreSQL’s maintained built-in JSONB functions when they cover the same operation.