> What I can't understand is why PQputCopyData() encodes incoming character 
> string, which was exported by "COPY ... TO '/tmp/t'" SQL command under psql 
> prompt, for bytea columns and refuse to accept or misinterpret zero value.

As far as PQputCopyData() is concerned, server and/or client does not have to 
decode input character string for bytea column, does they? My understanding is 
that all client or server need to do to import data to bytea column is 
un-escaping all sets of \nnn (or \x000) character strings back to binary bytes 
and unconditionally store the result to the target bytea column.

Encoding/Decoding is required only by TEXT and (VAR)CHAR columns, isn't it?

Errors like the following ones should not occur to bytea columns, should they?

ERROR:  invalid byte sequence for encoding "UTF8": 0x00
HINT:  This error can also happen if the byte sequence does not match the 
encoding expected by the server, which is controlled by "client_encoding".
CONTEXT:  COPY tablein, line 1: "abcd\011\000ABCDEFGH"
STATEMENT:  COPY tablein FROM STDIN

Regards,

CN

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to