jjson
jjson · Read top-level fields from JJSON binary values with TOAST slicing
Overview
PostgreSQL · 18
Usage
Sources:
- README.md
- jjson_postgres/README.md
- jjson_postgres/jjson.control
- jjson_postgres/jjson–0.1.0.sql
- jjson_postgres/test.sql
- jjson_postgres/install.sh
- jjson_postgres/lookup.c
jjson 0.1.0 reads individual top-level fields from the JJSON binary format stored in a bytea value. It combines a C PostgreSQL entry point with a Rust directory parser. The reviewed repository demonstrates PostgreSQL 18; it has no published release or explicit license grant.
Enable and Read
After the matching library and extension files are installed, a superuser can enable the relocatable extension. Preloading and a server restart are not required.
Populate payload with JJSON bytes produced by the repository’s separate Go CLI. Ordinary JSON text encoded as bytes is not JJSON. An application can bind the bytes directly; the upstream test uses pg_read_binary_file() only as a privileged fixture loader.
jjson_get(bytea, text) returns jsonb. A missing field or SQL-null argument returns SQL NULL; a stored JSON null remains 'null'::jsonb. The SQL function is IMMUTABLE STRICT. Keys and stored JSON use UTF-8, with conversion to and from the database encoding.
Storage and Limits
STORAGE EXTERNAL lets large values remain uncompressed so the C code can read TOAST slices for the footer, directory and selected value. It changes the storage policy; it does not convert existing JSON/JSONB documents or repack existing rows automatically.
Malformed footers, directories, JSON or encoding raise errors. There is no SQL update function or index access method in this revision: jjson_set is listed as future work. The CLI’s file update/vacuum operations are separate from PostgreSQL table updates and maintenance. The installed PostgreSQL library is jjson_lookup; the CLI is not an extension-installed binary.