postgresql json字段的查询语句

x33g5p2x  于2021-11-27 转载在 其他  
字(1.0k)|赞(0)|评价(0)|浏览(518)

数据库的存在的json字段

{"role": "COMPUTE", "vcpu": "1", "region": "ap-seoul-1", "userId": "12", "vendor": "oracle", "category": "COMPUTE_CLUSTER", "tenantId": "0", "clusterId": "7", "lifecycle": "ondemand", "scaleMode": "NONE", "fs-platform": "LINUX", "apiClusterId": "8", "cloudAccount": "FASTONE", "instanceType": "D3-c1-m4-g0", "partitionName": "partition0866", ".image_version": "7.5", "cloudImageName": "fs-centos-7.5", "deploy_node_id": "17", "fsInstanceType": "s2.c1.2"}
select * from event  where  resource_data->>'instanceType'='E4-c1-m4-g0'

resource_data 是数据库的字段名字
instanceType:是json中的key
‘E4-c1-m4-g0’:是json中的value

相关文章