Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 8DC05633377 for ; Wed, 8 Apr 2009 12:07:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 76168-09 for ; Wed, 8 Apr 2009 12:07:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.esilo.com (ns1.esilo.com [63.150.152.211]) by mail.postgresql.org (Postfix) with ESMTP id B3A98632D02 for ; Wed, 8 Apr 2009 12:07:31 -0300 (ADT) Received: from [10.0.0.2] (fwext-esilo-jupiter.esilo.com [64.135.45.146]) (authenticated bits=0) by mail.esilo.com (8.13.1/8.13.1) with ESMTP id n38F70EB006648 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 8 Apr 2009 11:07:01 -0400 Message-ID: <49DCBDBB.9070303@esilo.com> Date: Wed, 08 Apr 2009 11:07:39 -0400 From: Andrew Chernow User-Agent: Thunderbird 2.0.0.21 (X11/20090318) MIME-Version: 1.0 To: John Lister CC: pgsql-hackers@postgresql.org Subject: Re: Array types References: <89DBB5874E89413698A8E275E5E79154@squarepi.com> <4ECCF5BAADF94C5E9FD5CF2FA52CD061@squarepi.com> <49DCBB2F.7040406@esilo.com> In-Reply-To: <49DCBB2F.7040406@esilo.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/438 X-Sequence-Number: 136541 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/