Re: jsonb_set for nested new item?

Поиск
Список
Период
Сортировка
От Deven Phillips
Тема Re: jsonb_set for nested new item?
Дата
Msg-id CAJw+4NAJ0wpCxUrbiKoBpXW7rr=e3uny4pvaEY5yGc+_Lw8niA@mail.gmail.com
обсуждение исходный текст
Ответ на jsonb_set for nested new item?  (Deven Phillips <deven.phillips@gmail.com>)
Ответы Re: jsonb_set for nested new item?  (Vitaly Burovoy <vitaly.burovoy@gmail.com>)
Список pgsql-general
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@gmail.com> 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

В списке pgsql-general по дате отправления:

Предыдущее
От: Deven Phillips
Дата:
Сообщение: jsonb_set for nested new item?
Следующее
От: Арсен Арутюнян
Дата:
Сообщение: Transactions and functions