Search Postgresql Archives

Re: jsonb_set for nested new item?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Actually, it looks like I have to create all of the parent objects first before it would work... Is that correct?

Deven

On Fri, Sep 23, 2016 at 10:14 AM, Deven Phillips <deven.phillips@xxxxxxxxx> wrote:
Is there a way to set a nested element for which the parent paths do not yet exist?

For example, if I have a JSONB value called 'data':

{
    "foo": "bar"
}

and run

jsonb_set(data, {'boo', 'baz'}, 'newvalue')

I would expect the output to be:

{
    "foo": "bar",
    "boo": {
        "baz": "newvalue"
     }
}

But that does not appear to work..

Any suggestions would be appreciated.

Deven


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux