Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4eV0-0003HK-DF for pgsql-admin@arkaria.postgresql.org; Wed, 27 Jan 2021 06:40:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l4eUz-0000ts-1n for pgsql-admin@arkaria.postgresql.org; Wed, 27 Jan 2021 06:40:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l4eUy-0000tl-OG for pgsql-admin@lists.postgresql.org; Wed, 27 Jan 2021 06:40:16 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l4eUv-0005bv-H6 for pgsql-admin@postgresql.org; Wed, 27 Jan 2021 06:40:16 +0000 Received: by mail-ed1-x536.google.com with SMTP id c6so1086052ede.0 for ; Tue, 26 Jan 2021 22:40:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BHEecJ5UmR9CrldXU3lIP4yu9yS9GWYZ10PKaoxPQKA=; b=J3B7Qf46ahv/RS+3oXrOFGl3kFGUyg/Xh8Twkfo8TBKzORBrp8hSBCJwe7NFHs5PR6 FsIN3+uSh5zI4FvzsbzgMXjShxIPm+UB5kjI+kwxKWPNcqACTd74Fcc/f7T8ly8HOoSz setxAWU2FuzIOk065OrMZA3B74pEnLo3GGqHBrMYTU5Rt3dpZQr+wlVWNoX+zzHwUrPd vd3txId/QBA1r/FCoHErUmZfQFafCa1Z2Q96I1b/arb34EC1jzZa0tzBCWv0V2Gk7Ukq 3H9/sXfUWNZirT7+aMLeNW4/SYwbM/15IZ4pmzl8j9k72hYlj0BNEThQTfKWlncEZ/vB zYzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BHEecJ5UmR9CrldXU3lIP4yu9yS9GWYZ10PKaoxPQKA=; b=BLcTD903no4LExBjFVHPFUP/+cxCzDP+Wg9rewl0tNfQkkYNK6UmCKoclKp4iIV+bp vc6Y5NS9bdmAB6woIQnlxx7/FX1mG5c6RIfz1JOe/o20yAFWoa8j/01rBxd6W4azVXRj IIRIFgZU+3NXFKnFzMJZPXD0dFakXwv6noJd5KknE1T/o9CXqtaOuJXWdNiV9G5x9Ae0 5ocZuzA95JCOyPt7/3/hUaPL/YcIDJNFOUN/gd8d78PjCSCYu2pfL1kNg6on5Md9mMfr AM0Yq56UeEt4vI76Y6+doJaQl/R+VuK1JR4QZmIzzLnD3TZHOXVOzuh+Z7UCRAC/OhSN scpA== X-Gm-Message-State: AOAM533rJuNe64VxzkByqs6Q9fTwFKs9xpBmlhuYiPau57POGZ5uxAF/ qqOJPYwYsbn1DDyH7GVwllqtEZU2EKqGZQP5T6o= X-Google-Smtp-Source: ABdhPJzMAtbioKYzZzWmx5+XtSfbhS/GHj4ueqFWxkrLpM6LhYwzb49ib9NvUNDqCU4c5kNBdwZJMP9xKPxFCkjnvvE= X-Received: by 2002:a05:6402:1013:: with SMTP id c19mr7494504edu.298.1611729611722; Tue, 26 Jan 2021 22:40:11 -0800 (PST) MIME-Version: 1.0 References: <20210126135238.GA20826@alvherre.pgsql> <2338155.1611697339@sss.pgh.pa.us> In-Reply-To: <2338155.1611697339@sss.pgh.pa.us> From: Wells Oliver Date: Tue, 26 Jan 2021 22:39:35 -0800 Message-ID: Subject: Re: json_build_object, numeric types, and function limits on 100 arguments To: Tom Lane Cc: Alvaro Herrera , pgsql-admin Content-Type: multipart/alternative; boundary="000000000000fb13eb05b9dc0ad8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --000000000000fb13eb05b9dc0ad8 Content-Type: text/plain; charset="UTF-8" Thanks, Tom. Doing something like: with t as ( select somekey, someotherkey from mytable ) select json_agg(t)->0 from t; Feels a lot more, errr, natural. Would rather have the object than an array of 1 containing the object, thus the ->0 but this works well and feels SQL-ish indeed. On Tue, Jan 26, 2021 at 1:42 PM Tom Lane wrote: > Wells Oliver writes: > > 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. > > A more SQL-ish way to deal with this might be to use jsonb_agg() > or jsonb_object_agg(). > > regards, tom lane > -- Wells Oliver wells.oliver@gmail.com --000000000000fb13eb05b9dc0ad8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks, Tom. Doing something like:

with= t as ( select somekey, someotherkey from mytable ) select json_agg(t)->= 0 from t;

Feels a lot more, errr, natural. Would r= ather=C2=A0have=C2=A0the object than an array of 1 containing the object, t= hus the ->0 but this works well and feels SQL-ish indeed.

=



--
--000000000000fb13eb05b9dc0ad8--