Questions tagged «postgresql-json»


17
如何修改新的PostgreSQL JSON数据类型内的字段?
使用postgresql 9.3,我可以选择JSON数据类型的特定字段,但是如何使用UPDATE修改它们呢?我在postgresql文档中或在线上找不到任何示例。我尝试了明显的方法: postgres=# create table test (data json); CREATE TABLE postgres=# insert into test (data) values ('{"a":1,"b":2}'); INSERT 0 1 postgres=# select data->'a' from test where data->>'b' = '2'; ?column? ---------- 1 (1 row) postgres=# update test set data->'a' = to_json(5) where data->>'b' = '2'; ERROR: syntax error at or …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.