postgresql再帰使用json_set関数は、非最外層keyに対応するvalueの値を設定します.
2704 ワード
-- select id,button_setting::JSON -> 'pc' -> 'location' from chat_web
select id,(button_setting -> 'pc')::JSONB -> 'location'
from chat_web
where ((button_setting -> 'pc')::JSONB -> 'location')::text::int = 5
update chat_web
set button_setting = jsonb_set (button_setting, '{pc}' , jsonb_set( (button_setting -> 'pc')::jsonb , '{location}', '3' , false)::jsonb ,false )
where id = 153
select *
from chat_web
where id = 153