I am trying to update a jsonb field which has nested json objects in it using the concatenation operator in postgres as in dbfidde
But, it removes all other fields for example if I run the below script
UPDATE t
SET details = details || '{"name": {"firstname": "newname"},"address":{"city":"newCity"}}'
WHERE details -> 'name' ->>'firstname'='myname'
It removes the "lastname" field from the updated field
I tried updating with jsonb_set too but I am not sure how I can update multiple properties using jsonb_set