Postgres and jsonb - search value at any key
问题 Is possible to look for a given value at any key in a JSONB column in Postgres? In the documentation I can't see any example. Example value at a JSONB column: { a: 1, b: 2, c: 3 } I want to find all records that have 1 as a value anywhere. NOTE: there may be other keys than a, b, c unknown at the moment. 回答1: use value of jsonb_each_text , sample based on previous sample of McNets,: t=# select * from json_test join jsonb_each_text(json_test.data) e on true where e.value = '1'; id | data | key