Fix broken jsonb_set() logic for replacing array elements.
authorTom Lane <[email protected]>
Thu, 13 Oct 2016 04:25:28 +0000 (00:25 -0400)
committerTom Lane <[email protected]>
Thu, 13 Oct 2016 04:25:28 +0000 (00:25 -0400)
commit0e9e64c07ed93fb2be4583adaea28205d3188a0e
treeb29ffd0a829dd23db74e05ea4f790b630c2270f3
parent490734c588c4e70d46950c4f6c64dfd6e592cdcc
Fix broken jsonb_set() logic for replacing array elements.

Commit 0b62fd036 did a fairly sloppy job of refactoring setPath()
to support jsonb_insert() along with jsonb_set().  In its defense,
though, there was no regression test case exercising the case of
replacing an existing element in a jsonb array.

Per bug #14366 from Peng Sun.  Back-patch to 9.6 where bug was introduced.

Report: <20161012065349[email protected]>
src/backend/utils/adt/jsonfuncs.c
src/test/regress/expected/jsonb.out
src/test/regress/sql/jsonb.sql