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
Список
Дерево обсуждения
jsonb concatenation loses properties on nested objects Phillip Haydon <phillip.haydon@gmail.com>
Re: jsonb concatenation loses properties on nested objects Dmitry Dolgov <9erthalion6@gmail.com>
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
Дата:
От: Dmitry Dolgov
Дата: