↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / Json Functions And Operators

jsonb_path_query

Read the PG 18 manual

Returns all JSON items returned by the JSON path for the specified JSON value.

Reading PG 18current·documented in 9 of 27 versions, 12 to 20

Signatures & examples

jsonb_path_query ( target jsonb, path jsonpath [, vars jsonb [, silent boolean ]] ) → setof jsonb
Returns all JSON items returned by the JSON path for the specified JSON value. For SQL-standard JSON path expressions it returns the JSON values selected from target. For predicate check expressions it returns the result of the predicate check: true, false, or null. The optional vars and silent arguments act the same as for jsonb_path_exists.
select * from jsonb_path_query('{"a":[1,2,3,4,5]}', '$.a[*] ? (@ >= $min && @ <= $max)', '{"min":2, "max":4}') →  jsonb_path_query
------------------
 2
 3
 4
Version history 3
  1. 16 → 17 changed
  2. 12 → 13 changed
  3. 11 → 12 added

Definition snapshot: 2026-09-14T13:14:25.684213+00:00@99e6866c · English manual source