postgresql存储json时,有时候是以varchar类型存储的json数据,想要对该列数据做筛选。
1.postgresql json数据的筛选规则
2.eg
字段 report_man存储类型为varchar,数据样式
{
"account": "17711111111",
"avatar": "http://192.168.1.1:80/group1/M00/00/C6/wKgAZV7m0quAUTC1AAAz5wOGLrI719.jpg",
"id": "1346697955293868033",
"username": "张大鹏-管护员"
}
现对账户做筛选
select * from special_ship where report_man::json ->>'account'='17782751002'
如果你列的属性本就是json,则不需要“::json”这个来转json
其他场景可在上述1 中的网站自行获取