[英]Postgresql: How to search jsonb for LIKE value
我想看看一個字符串是否在 jsonb 中的任何地方的值中。 對鍵不感興趣,只對值感興趣。
就像是
select
the_reults
from
my_database
where
jsonb->>'*' LIKE '%123456%'
group by
whatever
order by
whatever
密鑰的通配符不起作用。 不過,123456 可能是一個數字。
有什么想法嗎?
謝謝!
你可以嘗試這樣的事情:
select
the_results
from
my_database
where
jsonb_path_exists (jsonb, '$.** ? (exists(@ like_regex "123456"))')
group by
whatever
order by
whatever
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.