pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedlibpq: COPY FROM STDIN BINARY of arrays
3+ messages / 2 participants
[nested] [flat]
* libpq: COPY FROM STDIN BINARY of arrays
@ 2023-03-30 15:40 Dominique Devienne <ddevienne@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Dominique Devienne @ 2023-03-30 15:40 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hi,
I already use arrays fine (e.g. text[]) in BINARY mode binds (with prepared
statement or not).
I already use COPY FROM STDIN BINARY fine, with scalar values.
But for the 1st time, I'm combining COPY with arrays,
and it is NOT fine yet :(
#08P01: ERROR: insufficient data left in message
CONTEXT: COPY UT_LibPQ_copy_arrays, line 1, column ptys
Does the wire-format of arrays differ between binary-binds and binary-copy?
Any pointers to what I could look at, to resolve this? doc? code? example?
Thanks, --DD
PS: If that helps, I'm willing to detail the break-down of all values /
bytes I'm sending
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: libpq: COPY FROM STDIN BINARY of arrays
@ 2023-03-30 16:00 Tom Lane <tgl@sss.pgh.pa.us>
parent: Dominique Devienne <ddevienne@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2023-03-30 16:00 UTC (permalink / raw)
To: Dominique Devienne <ddevienne@gmail.com>; +Cc: pgsql-general@lists.postgresql.org
Dominique Devienne <ddevienne@gmail.com> writes:
> Does the wire-format of arrays differ between binary-binds and binary-copy?
No.
> Any pointers to what I could look at, to resolve this? doc? code? example?
array_send and array_recv might help you. Keep in mind that maybe the
problem is with array element(s) not the array structure proper.
regards, tom lane
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: libpq: COPY FROM STDIN BINARY of arrays
@ 2023-03-31 12:34 Dominique Devienne <ddevienne@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Dominique Devienne @ 2023-03-31 12:34 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org
On Thu, Mar 30, 2023 at 6:00 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Dominique Devienne <ddevienne@gmail.com> writes:
> > Does the wire-format of arrays differ between binary-binds and
> binary-copy?
>
> No.
>
An update on this, I think I figure it out, by comparing with COPY TO
STDOUT WITH (FORMAT BINARY).
I was missing the byte-count "header" for the array. Since I'm reusing my
binary-bind code for COPY,
I'm missing the 4 bytes for the array's "total encoded byte length" before
the array data proper.
Now that I understand the issue, should be a simple matter to fix. Thanks
for chiming in Tom. --DD
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2023-03-31 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 15:40 libpq: COPY FROM STDIN BINARY of arrays Dominique Devienne <ddevienne@gmail.com>
2023-03-30 16:00 ` Tom Lane <tgl@sss.pgh.pa.us>
2023-03-31 12:34 ` Dominique Devienne <ddevienne@gmail.com>
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