docs: describe which SQL types jsonb_extract returns

The docs said jsonb_extract always returns BLOB. Scalars come back as
INTEGER, REAL, TEXT or NULL; only arrays, objects and multi-path
results come back as JSONB blobs.
This commit is contained in:
Pekka Enberg
2026-10-12 08:43:52 +03:00
parent 8906537f81
commit 13d2488c76

View File

@@ -211,7 +211,7 @@ jsonb_extract(json_text, path)
| `json_text` | TEXT or BLOB | A JSON document |
| `path` | TEXT | One or more JSON path expressions |
**Returns:** With a single path, returns the extracted value using its natural SQL type (INTEGER, REAL, TEXT, or NULL). JSON objects and arrays are returned as TEXT. With multiple paths, returns a JSON array of the extracted values. `jsonb_extract` returns BLOB.
**Returns:** With a single path, returns the extracted value using its natural SQL type (INTEGER, REAL, TEXT, or NULL). `json_extract` returns JSON objects and arrays as TEXT, while `jsonb_extract` returns them as a JSONB BLOB. With multiple paths, `json_extract` returns a JSON array of the extracted values as TEXT and `jsonb_extract` returns it as a JSONB BLOB.
```sql
SELECT json_extract('{"name":"Alice","age":30}', '$.name');