add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
create table contacts (id int, info json);

insert into contacts values
(5, '{"phone": {"homePhone": "035149065674", "workPhone": "0513715845"}, "mobile": {"mobile1": "0738487733", "mobile2": "07159065774"}}')
CREATE TABLE
INSERT 0 1
update contacts
set info = jsonb_set(info::jsonb, '{mobile,mobile1}', '"123456"')::json
where id = 5;

update contacts
set info = (info::jsonb #- '{mobile,mobile2}')::json
where id = 5;

update contacts
set info = jsonb_set(info::jsonb, '{mobile,mobile3}', '"123456"')::json
where id = 5;

select * from contacts;
UPDATE 1
UPDATE 1
UPDATE 1
id info
5 {"phone": {"homePhone": "035149065674", "workPhone": "0513715845"}, "mobile": {"mobile1": "123456", "mobile3": "123456"}}
SELECT 1