From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Wells Oliver <wells.oliver@gmail.com>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: json_build_object, numeric types, and function limits on 100 arguments
Date: Tue, 26 Jan 2021 10:52:38 -0300
Message-ID: <20210126135238.GA20826@alvherre.pgsql> (raw)
In-Reply-To: <CAOC+FBU_qEQJxyw03ag_5jryAjB+43frFLveivx3uH=uNo--1w@mail.gmail.com>
On 2021-Jan-25, Wells Oliver wrote:
> Hi. I am trying to build a Large JSON Object, and running into issues with
> the function limit on 100 arguments. I know I can use ARRAY[] to get around
> this, but I can't mix text and numeric types, which I need to do to have a
> nicely usable JSON object.
>
> I know I can do this: json_build_object('somekey', 1.0, 'someotherkey',
> 2.0) but cannot put more than 100.
Maybe you can use the jsonb || jsonb operator:
select json_build_object('somekey', 1.0, 'someotherkey', 2.0)::jsonb || json_build_object('thirdkey', 3.0)::jsonb;
?column?
────────────────────────────────────────────────────────
{"somekey": 1.0, "thirdkey": 3.0, "someotherkey": 2.0}
(1 fila)
--
Álvaro Herrera 39°49'30"S 73°17'W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: alvherre@alvh.no-ip.org, wells.oliver@gmail.com
Subject: Re: json_build_object, numeric types, and function limits on 100 arguments
In-Reply-To: <20210126135238.GA20826@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox