]> granicus.if.org Git - postgresql/commit
Fix two-argument jsonb_object when called with empty arrays
authorAndrew Dunstan <andrew@dunslane.net>
Sun, 21 Feb 2016 15:30:49 +0000 (10:30 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Sun, 21 Feb 2016 15:30:49 +0000 (10:30 -0500)
commit94c745eb189e2122a3ff86c24443b11408ea2376
treece9b310d0b9d5080ca9ed26b41e82739fa762e34
parent88aca5662d6a6362ce8c5aba08f469e92f44a1e7
Fix two-argument jsonb_object when called with empty arrays

Some over-eager copy-and-pasting on my part resulted in a nonsense
result being returned in this case. I have adopted the same pattern for
handling this case as is used in the one argument form of the function,
i.e. we just skip over the code that adds values to the object.

Diagnosis and patch from Michael Paquier, although not quite his
solution.

Fixes bug #13936.

Backpatch to 9.5 where jsonb_object was introduced.
src/backend/utils/adt/jsonb.c
src/test/regress/expected/json.out
src/test/regress/expected/jsonb.out
src/test/regress/sql/json.sql
src/test/regress/sql/jsonb.sql