Re: Libpq: copy file to bytea column

Поиск
Список
Период
Сортировка
От seiliki@so-net.net.tw
Тема Re: Libpq: copy file to bytea column
Дата
Msg-id 20100308135159.EB4E7F4820A@m5.so-net.net.tw
обсуждение исходный текст
Ответ на Re: Libpq: copy file to bytea column  (seiliki@so-net.net.tw)
Список 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-escapingall sets of \nnn (or \x000) character strings back to binary bytes and unconditionally store the result to
thetarget 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
controlledby "client_encoding". 
CONTEXT:  COPY tablein, line 1: "abcd\011\000ABCDEFGH"
STATEMENT:  COPY tablein FROM STDIN

Regards,

CN

В списке pgsql-general по дате отправления:

Предыдущее
От: seiliki@so-net.net.tw
Дата:
Сообщение: Re: Libpq: copy file to bytea column
Следующее
От: Devrim GÜNDÜZ
Дата:
Сообщение: PostgreSQL RPM sets for 9.0 Alpha4 released