我在psql数据库的json类型字段中遇到一些搜索问题, 这是案例场景
我在json类型字段中有这个示例数据
{"created_at": "2014-11-09 00:28:50", "id": 6, "operation": "UPDATE", "desc": "DB updation V3_19 "}
[{"created_at": "2014-11-16 18:21:22", "id": 6, "operation": "UPDATE", "desc": "DB updation V3_19 "}]
{"created_at": "2015-03-18 08:25:07", "id": 7, "operation": "INSERT", "desc": "DB INSERTION V3_24 "}
[{"created_at": {"$date": "2014-08-05T00:30:15.843+0500"}, "id": 5, "desc": "replaced from DB"}, {"created_at": "2014-11-17 00:08:42", "id": 6, "operation": "UPDATE", "desc": "DB updation V3_19 "}]
{"created_at": "2015-03-18 08:25:07", "id": 7, "operation": "INSERT", "desc": "DB INSERTION V3_24 "}
{"created_at": "2015-03-18 08:25:07", "id": 7, "operation": "INSERT", "desc": "DB INSERTION V3_24 "}
我只想查询那些operation = 'INSERT' and desc = 'DB INSERTION V3_24'
但当我在做这个简单的查询时select count(*) from factual where info_flags->>'operation' = 'INSERT'
info_flags是json_type列的名称,
它给了我错误"错误:无法从非对象中提取字段"
任何人都可以指导我是数据不一致错误还是查询有问题。
谢谢