From: Tom Lane <tgl@sss.pgh.pa.us>
To: Teunis Peters <teunis@wintersgift.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: Two seperate problems with libpq - arrays and bytea edit
Date: Sat, 14 May 2005 14:51:13 -0400
Message-ID: <5157.1116096673@sss.pgh.pa.us> (raw)
In-Reply-To: <4dc6bdd876380e9a6d8673c5d36c449f@wintersgift.com>
References: <4dc6bdd876380e9a6d8673c5d36c449f@wintersgift.com>
Teunis Peters <teunis@wintersgift.com> writes:
> I'm trying to figure out how to read from and write to bytea values and
> array (specifically "text[2][]" for a key:value 'dictionary') and
> cannot figure it out.
Well, since you are asking for binary output format from PQexecParams,
the bytea result is going to just be raw binary data: you should not be
trying to apply PQunescapeBytea to it. I don't know the notation you
are using well enough to tell what's wrong with your second variant.
> Arrays I'm completely lost - I haven't a clue what the format would be.
Looking at array_send, the binary wire format is
number of dimensions (int4)
flags (int4)
element type id (Oid)
for each dimension:
dimension length (int4)
dimension lower subscript bound (int4)
for each array element:
element value, in the appropriate format
The "flags" are currently always 0, and I would recommend punting if
you see something else, since something else would very possibly
indicate a change in the wire format.
Don't forget that the wire format for integers is network byte order
(ie, big-endian).
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, teunis@wintersgift.com
Subject: Re: Two seperate problems with libpq - arrays and bytea edit
In-Reply-To: <5157.1116096673@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox