如何解决如何删除postgresql json类型中另一个子文档中的子文档
{
"bundles": {
"one": {
"phishingGroup": "Club","maxAllowedSeats": 3,"upgradePlans": []
},"awareness_club_no_payment": {
"phishingGroup": "Club-Old","maxAllowedSeats": 4,"upgradePlans": []
}
},"features": {
"abc": {
"new_welcome_page": {
"state": "active"
},"welcome_page": {
"state": "active","value": "start"
},"can_upgrade_plan": {
"state": "active"
}
}
},"baseFeatures": {
"new_welcome_page": {
"state": "active"
},"welcome_page": {
"state": "active"
},"can_upgrade_plan": {
"state": "active"
}
}
}
以上是我的JSON,我想从子文档“base_features”中删除子文档“welcome_page”和“new_welcome_page”
我在谷歌上搜索了很多,认为我可以使用下面的查询来做到这一点。
update tenants t set properties =
jsonb_set(config,'{base_features}',(config->'base_features') - 'welcome_page') where t.id = 100;
但是 Postgres 给出了这个错误操作符不存在 json - 未知。 我想我那边的“-”出了点问题。并且 Postgres 无法理解 RHS 的类型。
请帮帮我。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。