[英]Check if string is substring of any element in jsonb array in Postgres
我在 Postgres 數據庫中有一個jsonb
類型的列。 如何檢查字符串是否是 jsonb 數組中任何元素的子字符串? 理想情況下,該解決方案還將忽略大寫。
嘗試這個 :
with cte as (
select jsonb_array_elements('["hello", "world", "earth", "universe"]') as word
from test
)
select cte.word, position('wor' in cte.word::text) > 0 "isSubstr"
from cte;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.