json_build_object, numeric types, and function limits on 100 arguments

From: Wells Oliver <wells(dot)oliver(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: json_build_object, numeric types, and function limits on 100 arguments
Date: 2021-01-25 22:41:33
Message-ID: CAOC+FBU_qEQJxyw03ag_5jryAjB+43frFLveivx3uH=uNo--1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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.

What I can't do is json_build_object(array['somekey', 1.0, 'someotherkey',
2.0]); (json_object() with the same error): invalid input syntax for type
numeric: "somekey"

What I can do but don't want to do is json_object(array['somekey', '2.0',
'someotherkey', '2.0']) because you have a poorly typed JSON object that's
less helpful downstream.

Any options for me?

--
Wells Oliver
wells(dot)oliver(at)gmail(dot)com <wellsoliver(at)gmail(dot)com>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message S Bob 2021-01-25 22:44:32 Unique constraint across all partitions?
Previous Message Mr Doss 2021-01-25 10:36:06 You're invited to share this calendar