On 10/25/19 6:40 AM, Andrew Dunstan wrote:
json{b}_build_object and json{b}_build_array are designed for creating nested json{b}. Not sure if they would work for your purpose.
Thanks for the suggestion! I looked at these a bit, but they only work if you have a known-ahead-of-time number of arguments. (I did explore building an array and calling jsonb_build_object using VARIADIC, but you can't build an array with alternating text & jsonb elements. That made me curious how these functions even worked, which led me to extract_variadic_args (utils/fmgr/funcapi.c), which has some magic to support heterogeneous types when not called with the VARIADIC keyword, so it seems they bypass the normal variadic handling.)
Regards, -- Paul ~{:-) p...@illuminatedcomputing.com