简体   繁体   English

JSONB列查询

[英]JSONB column query

There is a JSONB column ( some_strings ) that has value like string array 有一个JSONB列( some_strings ),其值类似于字符串数组

---------------------
["string1","string2","string3"]
["string5"]
["string6","string7"]

-------etc-----------

Is there a way to make a query to get row where (some_strings) contain "string2" ? 有没有一种方法可以查询以获取其中(some_strings)包含“ string2”的行?

This query will return records where string2 appears anywhere in the JSONB array: 此查询将返回在JSONB数组中任何地方出现string2记录:

SELECT *
FROM yourTable
WHERE some_strings ?& array['string2']

Documentation 文献资料

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM