Re: Accessing composite type elements - Mailing list pgsql-general

From Tom Lane
Subject Re: Accessing composite type elements
Date
Msg-id 1026409.1654187025@sss.pgh.pa.us
Whole thread Raw
In response to Accessing composite type elements  (Garfield Lewis <garfield.lewis@lzlabs.com>)
Responses Re: [EXT] Re: Accessing composite type elements
List pgsql-general
Garfield Lewis <garfield.lewis@lzlabs.com> 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
compositetype, 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



pgsql-general by date:

Previous
From: Garfield Lewis
Date:
Subject: Accessing composite type elements
Next
From: Garfield Lewis
Date:
Subject: Re: [EXT] Re: Accessing composite type elements