我的表中有一列“fields”。 它包含了这样的事情:在postgres中选择JSON 9.5
{"creative_url": {"required": true, "data_type": "string"}}
或
{"creative_name_field": {"required": false, "data_type": "integer"}}
所以,在主字典不同的密钥。
我想选择的所有行:
"required": true
尝试类似:
select *
from my_table
where fields @> '{"required":true}'
但它表明我没有(找到0行)。
Postgres documentation不给我任何其他方法来做到这一点。 什么问题?
真的很难理解这个查询)但它的工作! – Snobby