Postgresql更新json数据属性

Fat*_*ğan 4 postgresql json jsonb postgresql-9.4 postgresql-9.6

我创建了一个字段名称是结果,类型是文本.我只是想在列中更新'lat'.当我使用此查询时,我收到语法错误.我能怎么做?

列数据是

"{"lat":"48.00855","lng":"58.97342","referer":"https:\/\/abc.com\/index.php"}"
Run Code Online (Sandbox Code Playgroud)

查询是

update public.log set (result::json)->>'lat'=123 where id=6848202
Run Code Online (Sandbox Code Playgroud)

语法错误是

ERROR:  syntax error at or near "::"
Run Code Online (Sandbox Code Playgroud)

kli*_*lin 9

使用jsonb连接运算符(Postgres 9.5+):

update log
set result = result::jsonb || '{"lat":"123"}'
where id = 6848202
Run Code Online (Sandbox Code Playgroud)