【发布时间】:2012-11-16 22:26:24
【问题描述】:
我在数据库(postgres 9.2.1)中有一个文本字段,其中有一个 json blob。显然,它看起来与此类似,除了都在一行中:
{
"keyword": {
"checked": "1",
"label": "Keyword"
},
"agency_name": {
"checked": "0",
"label": "Agency Name"
}
}
我需要向 json 数组添加一个元素,使其看起来像这样:
{
"keyword": {
"checked": "1",
"label": "Keyword"
},
"something_new": {
"checked": "1",
"label": "Something New"
},
"agency_name": {
"checked": "0",
"label": "Agency Name"
}
}
我并不关心新数组元素的位置。它可能在机构名称之后。在 postgres 中是否有一种简单的方法可以做到这一点?
【问题讨论】:
-
尝试阅读 stackoverflow.com/questions/10560394/… 。它可能会帮助你。
-
可能属于数据库管理员组
标签: json string postgresql select replace