From: | Wells Oliver <wells(dot)oliver(at)gmail(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | pgsql-admin <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: json_build_object, numeric types, and function limits on 100 arguments |
Date: | 2021-01-26 19:10:32 |
Message-ID: | CAOC+FBUobjupfTb9BKctomaygUf6_24AZo0QHQ2g2e1GaGL7tQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Yeah, thanks, I thought about that: concatenating a few different objects
to make a bigger object. Seemed silly, but if there's not a cleaner
solution, it does work.
On Tue, Jan 26, 2021 at 5:52 AM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:
> 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
>
--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-01-26 21:42:19 | Re: json_build_object, numeric types, and function limits on 100 arguments |
Previous Message | Paul Förster | 2021-01-26 14:43:42 | Re: How to change mode for cluster log? |