From: | Phillip Haydon <phillip(dot)haydon(at)gmail(dot)com> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | jsonb concatenation loses properties on nested objects |
Date: | 2016-06-28 16:44:48 |
Message-ID: | CAMa+EKB4hJ2q_JA1RC=ErstN9zi8=VqkSRTpX5LGCnwqZeTgng@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Dmitry Dolgov | 2016-06-28 17:55:36 | Re: jsonb concatenation loses properties on nested objects |
Previous Message | Tom Lane | 2016-06-28 16:05:43 | Re: BUG #14217: Respect $CFLAGS from /usr/local/etc/config.site |