-1

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 ?

1

On 9.3 you will have to rewrite your jsonb value. From 9.5 you could use jsonb_set() to simplify the task.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.