Re: Add json_object(text[], json[])?

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add json_object(text[], json[])?
Date: 2019-10-25 18:32:05
Message-ID: 7f99e6b8-1823-7738-2788-e97105d906af@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 ~{:-)
pj(at)illuminatedcomputing(dot)com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2019-10-25 19:09:24 Re: fairywren failures
Previous Message Pavel Stehule 2019-10-25 17:00:06 Re: [Proposal] Global temporary tables