Libpq: copy file to bytea column

Поиск
Список
Период
Сортировка
От seiliki@so-net.net.tw
Тема Libpq: copy file to bytea column
Дата
Msg-id 20100306132146.43819F480CA@m5.so-net.net.tw
обсуждение исходный текст
Ответы Re: Libpq: copy file to bytea column  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-general
Hi!

The data types of tableout.c1 and tablein.c1 are both bytea. I first export tableout.c1 to a file:

db1=# COPY (SELECT c1 FROM tableout LIMIT 1) TO '/tmp/t';

Then I try to import the file to another table.

This works without flaw:

db1=# COPY tablein FROM '/tmp/t';

However, I get the following errors from log when calling libpq functions PQputCopyData() and PQputCopyEnd().

2010-03-06 20:47:42 CST ERROR:  invalid byte sequence for encoding "UTF8": 0x00
2010-03-06 20:47:42 CST HINT:  This error can also happen if the byte sequence does not match the encoding expected by
theserver, which is controlled by "client_encoding". 
2010-03-06 20:47:42 CST CONTEXT:  COPY in, line 1:
"TPF0\011Report\000\003Tag\002\365\016ExportFromPage\002\000\014ExportToPage\002\000\006Values\016..."
2010-03-06 20:47:42 CST STATEMENT:  COPY in FROM STDIN


Helps will be much appreciated!

CN

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

Предыдущее
От: Michael Wood
Дата:
Сообщение: Re: [NOVICE] How to find details of arguments in all functions in postgre - One solution
Следующее
От: Adrian von Bidder
Дата:
Сообщение: Filesysstems