[英]Postgresql: How to search jsonb for LIKE value
I want to see if a string is in the values anywhere within a jsonb.我想看看一个字符串是否在 jsonb 中的任何地方的值中。 Not interested in the keys, just values.
对键不感兴趣,只对值感兴趣。
Something like就像是
select
the_reults
from
my_database
where
jsonb->>'*' LIKE '%123456%'
group by
whatever
order by
whatever
Wildcard for the key doesn't work.密钥的通配符不起作用。 It could be that 123456 is a number though.
不过,123456 可能是一个数字。
Any ideas there?有什么想法吗?
Thanks!谢谢!
You can try something like this:你可以尝试这样的事情:
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.