【发布时间】:2014-11-05 07:00:40
【问题描述】:
我有一个 json 作为文本存储在我的数据库行之一中。 json数据如下
[{"id":67272,"name":"EE_Quick_Changes_J_UTP.xlsx"},{"id":67273,"name":"16167.txt"},{"id":67274,"name":"EE_12_09_2013_Bcum_Searchall.png"}]
要解析这个我想使用 postgresql 方法
json_populate_recordset()
当我发布类似
的命令时select json_populate_recordset(null::json,'[{"id":67272,"name":"EE_Quick_Changes_J_UTP.xlsx"},{"id":67273,"name":"16167.txt"},{"id":67274,"name":"EE_12_09_2013_Bcum_Searchall.png"}]') from anoop;
它给了我以下错误 json_populate_recordset 的第一个参数必须是行类型
注意:在 from 子句中“anoop”是表名。
谁能建议我如何使用 json_populate_recordset 方法从这个 json 字符串中提取数据。
我的方法参考来自 http://www.postgresql.org/docs/9.3/static/functions-json.html
【问题讨论】:
标签: json postgresql postgresql-9.3