PG 对 json 的支持真是美如画
https://www.postgresql.org/docs/9.5/functions-json.html
比如 hello 表有个 result 字段长这样
"result": {
"items": [
"warrants",
"convertiables"
],
"warrants": {
"index": 10
}
}需要把index大于0的记录找出来
SELECT *
FROM hello
WHERE (result -> 'warrants' ->> 'index') :: INT > 0爽的很啊