Process variadic arguments consistently in json functions

Andrew Dunstan <andrew@dunslane.net>

Commit: 9cb28e98b818288b70f165d08ddd295b799466c2
Author: Andrew Dunstan <andrew@dunslane.net>
Date: 2017-10-25T11:52:45Z
Releases: 9.4.15
Process variadic arguments consistently in json functions

json_build_object and json_build_array and the jsonb equivalents did not
correctly process explicit VARIADIC arguments. They are modified to use
the new extract_variadic_args() utility function which abstracts away
the details of the call method.

Michael Paquier, reviewed by Tom Lane and Dmitry Dolgov.

Backpatch to 9.5 for the jsonb fixes and 9.4 for the json fixes, as
that's where they originated.

Files

PathChange+/−
src/backend/utils/adt/json.c modified +24 −60
src/test/regress/expected/json.out modified +107 −0
src/test/regress/sql/json.sql modified +21 −0