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 1nwnc5-0006Tu-62 for pgsql-general@arkaria.postgresql.org; Thu, 02 Jun 2022 16:23:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nwnc3-00019K-AA for pgsql-general@arkaria.postgresql.org; Thu, 02 Jun 2022 16:23:55 +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 1nwnc2-00019A-Vk for pgsql-general@lists.postgresql.org; Thu, 02 Jun 2022 16:23:54 +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 1nwnc0-0001Tk-HS for pgsql-general@postgresql.org; Thu, 02 Jun 2022 16:23:54 +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 252GNjZX1026410; Thu, 2 Jun 2022 12:23:45 -0400 From: Tom Lane To: Garfield Lewis cc: "pgsql-general@postgresql.org" Subject: Re: Accessing composite type elements In-reply-to: References: Comments: In-reply-to Garfield Lewis message dated "Thu, 02 Jun 2022 15:20:57 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1026408.1654187025.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 02 Jun 2022 12:23:45 -0400 Message-ID: <1026409.1654187025@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Garfield Lewis writes: > In my client-side C code I am using PQgetvalue to pull in the data from = the row/column. However, since it is a composite type, it is unclear to me= how to get the individual members from the data. Binary representations are not too well documented :-(. However, looking at record_send() helps here. > My best guess right now is: > * 0x2 is the number of members > * 0x4 and 0x143 are the lengths of the individual members > * 0x17 and 0x8e are the OID for the member type Right, with the additional proviso that -1 "length" indicates a null field value. regards, tom lane