psql: JSONB column query

The @> operator queries for an object subset of the target.

To add a predicate where json_column contains {"foo": "bar"}:

where json_column::jsonb @> '{"foo":"bar"}'::jsonb

https://www.postgresql.org/docs/9.4/functions-json.html

Published on: 03 Apr 2023