I have a table with following definition:
create table json_test (
my_data jsonb);
Inserted to it values like this:
{"details": [
{
"f1": "",
"f2": "free text"
},
{
"f1": "",
"f2": "free text"
}
]}
Now I want to update this jsonb column(f1 to null):
{"details": [
{
"f1": null,
"f2": "free text"
},
{
"f1": null,
"f2": "free text"
}
]}
I want to change the f1
from string to null.
How to achieve this ?
Best Answer
On 9.3 you will have to rewrite your
jsonb
value. From 9.5 you could usejsonb_set()
to simplify the task.