I have a table with following definition:
CREATE TABLE USER_CONFIGURATIONS (
ID BIGSERIAL PRIMARY KEY,
DATA JSONB
);
I have a data field that looks like this :
[
{
"user_id": 1,
"user_name": "demo_user",
"is_manager": 1,
"options": [
{
"phone":{
"home":"XXXXXXX",
"work":"XXXXXXX"
},
"address":{
"home":"XXXXXXX",
"work":"XXXXXXX"
}
}
]
},
...
]
questions:
- how to update "user_name" ?
how to update "options->phone->home" ?
UPDATE USER_CONFIGURATIONS SET DATA = jsonb_set(...) WHERE ...user_id=1;
postgres 9.6 version. i tried with jsonb_set() but not wokring