I have a table xyz, with a metadata jsonb column in postgres.Table : xyz
column : metadata, type = jsonb
metadata = {"exceptions": {"first_exception": "first_value"} }
I want to add a new sub_attribute
desired metadata = {"exceptions": {"first_exception": "123"},{"second_exception": "234"} }
I can use the
update xyz
SET metadata = jsonb_set(metadata->'exceptions', '{second_exception}', '"234"', true).
But I want to get the value 234
from a select query. I am not able to figure how to combine the select query with the update to do this.