From: | seiliki(at)so-net(dot)net(dot)tw |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Libpq: copy file to bytea column |
Date: | 2010-03-08 13:51:52 |
Message-ID: | 20100308135159.EB4E7F4820A@m5.so-net.net.tw |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Devrim GÜNDÜZ | 2010-03-08 15:02:01 | PostgreSQL RPM sets for 9.0 Alpha4 released |
Previous Message | seiliki | 2010-03-08 12:52:30 | Re: Libpq: copy file to bytea column |