在PostgreSQL的jsonb字段中使用LIKE运算符处理对象数组 [英] Using LIKE operator for array of objects inside jsonb field in PostgreSQL
本文介绍了在PostgreSQL的jsonb字段中使用LIKE运算符处理对象数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以对PostgreSQL 9.4中jsonb字段的对象数组内的单个键/值使用LIKE运算符?例如,我有:
Is it possible to use LIKE operator for single key/value inside array of objects for jsonb field in PostgreSQL 9.4? For example I have:
id | body
------------------------------------------------------------
1 | {"products": [{"name": "qwe", "description": "asd"}, {"name": "zxc", "description": "vbn"}]}
我知道,我可以得到这样的product
:
I know, I can get a product
with something like this:
select * from table where 'body'->'products' @> '[{"name": "qwe"}]'::jsonb
问题是:如果我不知道它的全名,我可以得到这个产品吗?
The question is: can I get this product if I don't know full name of it?
推荐答案
查看全文