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 1kqIVE-0003lB-1f for pgsql-general@arkaria.postgresql.org; Fri, 18 Dec 2020 16:21:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kqIVD-0001n7-21 for pgsql-general@arkaria.postgresql.org; Fri, 18 Dec 2020 16:21:11 +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 1kqIUj-0005Xs-JK for pgsql-general@lists.postgresql.org; Fri, 18 Dec 2020 16:20:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqIUh-0001Nt-Ac for pgsql-general@postgresql.org; Fri, 18 Dec 2020 16:20:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0BIGKYSD160623; Fri, 18 Dec 2020 11:20:34 -0500 From: Tom Lane To: "David G. Johnston" cc: Joel Jacobson , pgsql-general Subject: Re: Avoid undesired flattening of jsonb arrays? In-reply-to: References: <0d72b76d-ca2b-4263-8888-d6dfca861c51@www.fastmail.com> Comments: In-reply-to "David G. Johnston" message dated "Fri, 18 Dec 2020 08:33:51 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <160621.1608308434.1@sss.pgh.pa.us> Date: Fri, 18 Dec 2020 11:20:34 -0500 Message-ID: <160622.1608308434@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "David G. Johnston" writes: > I'll agree that the description could discuss the case explicitly, and the > array||scalar case could be added to the examples. Yeah, the documentation completely fails to explain what happens when the inputs aren't two arrays or two objects. I'd kind of assumed that that's an error, but it isn't. Some experimentation indicates that the behavior in all cases except two objects is to convert any non-array input to a one-element array, reducing the situation to the two-array case. regards, tom lane