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 1phW7H-0002uS-1y for pgsql-general@arkaria.postgresql.org; Wed, 29 Mar 2023 13:45:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1phW7F-0007y6-IY for pgsql-general@arkaria.postgresql.org; Wed, 29 Mar 2023 13:45:29 +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 1phW7F-0007xx-7s for pgsql-general@lists.postgresql.org; Wed, 29 Mar 2023 13:45:29 +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 1phW7C-0004ng-E7 for pgsql-general@postgresql.org; Wed, 29 Mar 2023 13:45:28 +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 32TDjNVJ3855182; Wed, 29 Mar 2023 09:45:24 -0400 From: Tom Lane To: Dominique Devienne cc: pgsql-general@postgresql.org Subject: Re: libpq: empty arrays have rank 0 in binary results? whatever the type's rank? In-reply-to: References: Comments: In-reply-to Dominique Devienne message dated "Wed, 29 Mar 2023 15:37:10 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3855180.1680097523.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 29 Mar 2023 09:45:23 -0400 Message-ID: <3855181.1680097523@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne writes: > Hi. Selecting/fetching an empty 1D array using a binary-mode PGresult, > gives me back 12 bytes, and the first 4, the rank, is 0, something I was > not expecting. Yeah, empty arrays have zero dimensions. > PS: On a side note; where can I find the sending code for arrays? > I didn't find the usual _send() and _recv() functions (but looking on > github online...) https://git.postgresql.org/gitweb/?p=3Dpostgresql.git;a=3Dblob;f=3Dsrc/bac= kend/utils/adt/arrayfuncs.c;h=3D87c987fb2704761c59333bf8c1fee47e5c14c598;h= b=3DHEAD#l1583 regards, tom lane