我想用PostgreSQL在jsonb数据类型列中的数据上查找行,这是对数组项进行搜索的正确语法吗?
SELECT * FROM table
WHERE diff_data @> '{"rfc6902": [{"op": "replace", "path": "/status/"}, "value": "0"]}';
输出下表中的第一行
表
id | diff_data
1 | {"rfc6902": [{"op": "replace", "path": "/status", "value": "0"}]}
2 | {"rfc6902": [{"op": "replace", "path": "/status", "value": "1"}]}