Re: Array types

From: "John Lister" <john(dot)lister-ps(at)kickstone(dot)com>
To: "Andrew Chernow" <ac(at)esilo(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Array types
Date: 2009-04-08 15:11:55
Message-ID: 24AD6A221A5B4B03B87163A772D2F8BB@squarepi.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Cheers for the pointers. Am i right in thinking that if i get an array of
arrays, the nested arrays are sent in wire format as well - it seems to be
from the docs.

Secondly, comments are a bit scarse in the code, but am i also right in
thinking that an array indexing can start at an arbitrary value? This seems
to be what the lbound value is for... or is this a addition to deal with
nulls eg, {null, null, null, 4} would have a lbound of 3.... (or both)

Thanks

----- Original Message -----
From: "Andrew Chernow" <ac(at)esilo(dot)com>
To: "John Lister" <john(dot)lister-ps(at)kickstone(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Sent: Wednesday, April 08, 2009 4:07 PM
Subject: Re: [HACKERS] Array types

> Andrew Chernow wrote:
>> John Lister wrote:
>>> Following this up, is there any docs on the binary wire format for
>>> arrays?
>>>
>>
>> None that I know of.
>>
>> Check out the backend source: (array_recv() and array_send() functions)
>> http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/arrayfuncs.c?rev=1.154
>> Or, look at libpqtypes array.c:
>> http://libpqtypes.esilo.com/browse_source.html?file=array.c
>>
>
> Forgot to mention, this is not as simple as understanding the array
> format. You have to understand the wire format for all types that can be
> array elements. The array wire format serializes its array elements as
> [elem_len][elem_data]. elem_data is the wire format of the array element
> type, like an int, timestamp, polygon, bytea, etc... So once you unravel
> the array container format, you still have to demarshal the type data.
>
> --
> Andrew Chernow
> eSilo, LLC
> every bit counts
> http://www.esilo.com/
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Lister 2009-04-08 15:15:40 Re: Array types
Previous Message Merlin Moncure 2009-04-08 15:10:35 Re: Array types