jsonb concatenation loses properties on nested objects

Поиск
Список
Период
Сортировка
От Phillip Haydon
Тема jsonb concatenation loses properties on nested objects
Дата
Msg-id CAMa+EKB4hJ2q_JA1RC=ErstN9zi8=VqkSRTpX5LGCnwqZeTgng@mail.gmail.com
обсуждение исходный текст
Ответы Re: jsonb concatenation loses properties on nested objects  (Dmitry Dolgov <9erthalion6@gmail.com>)
Список pgsql-bugs
I'm not sure if this is by design or not but I find it strange and believe
it's a bug.

If you concat two jsonb docs together, all first level properties are added
or modified.

Given:

select '{"FirstName": "Phillip"}'::jsonb || '{"LastName": "Haydon"}'::jsonb


You will get a result of:

{"LastName": "Haydon", "FirstName": "Phillip"}


However, if you have an object value with properties in that object that
differ between docs. The nested properties are lost.

select '{"User": {"FirstName": "Phillip"}}'::jsonb || '{"User":
{"LastName": "Haydon"}}'::jsonb


This results in:

{"User": {"LastName": "Haydon"}}


Based on the result of the first example I would have expected:

{"User": {"LastName": "Haydon", "FirstName": "Phillip"}}





Is this by design or is it a bug?


Thanks.


--

Kind Regards,
Phillip Haydon
www.philliphaydon.com

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site
Следующее
От: Dmitry Dolgov
Дата:
Сообщение: Re: jsonb concatenation loses properties on nested objects