1、pgsql 修改text内容sql
UPDATE my_table SET my_column = TEXT 'Text value';
2、修改json字段中json的某个key中的内容
update table set data = (data::jsonb || '{"key":"123"}') where id= 12;
3、 修改json中多条item中的一条某key的值
UPDATE apppaymentrelation AS G
SET paydetails = REPLACE ( paydetails :: TEXT, '"option": [{"item": "908"}, {"item": "890"}, {"item": "789"}, { "item": "123"}, {"item": "456"}]', '"option": [{ "item": "123123"}]' ) :: JSON
WHERE
G.id IN (
SELECT G.id FROM apppaymentrelation AS G CROSS JOIN jsonb_array_elements(G.paydetails::jsonb) AS j WHERE j ->> 'label' = 'py' ORDER BY G.id
);
4、查询json字段中某个值
SELECT data->>'name' from table where id=12
5、