Re: COPY 'invalid byte sequence for encoding "UTF8": 0xff'

Поиск
Список
Период
Сортировка
От Steve Crawford
Тема Re: COPY 'invalid byte sequence for encoding "UTF8": 0xff'
Дата
Msg-id 49EE04E0.6070702@pinpointresearch.com
обсуждение исходный текст
Ответ на COPY 'invalid byte sequence for encoding "UTF8": 0xff'  (Chris Worley <chris.worley@timco.aero>)
Ответы Re: COPY 'invalid byte sequence for encoding "UTF8": 0xff'  (Chris Worley <chris.worley@timco.aero>)
Список pgsql-general
Chris Worley wrote:
> Hello,
>
> I get the following error when running a sql script containing a COPY command:
>
> ERROR:  invalid byte sequence for encoding "UTF8": 0xff...
>
> The data I have contains binary data from a tcp dump....
>
> Does anybody know how the dump pulls a column with binary data?  It is
> a varchar column
No, if it it binary data, you need a column of type bytea and you need
to escape the appropriate characters in your input. For example, if I
create a table with a single bytea column called "foo" and insert the a
record with value "^F^O^O" then dump it, the dump will have the following:

COPY byteatest (foo) FROM stdin;
\\006\\017\\017
\.

See http://www.postgresql.org/docs/8.3/static/datatype-binary.html for
the characters that need to be escaped.

Cheers,
Steve


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

Предыдущее
От: Chris Worley
Дата:
Сообщение: COPY 'invalid byte sequence for encoding "UTF8": 0xff'
Следующее
От: Chris Worley
Дата:
Сообщение: Re: COPY 'invalid byte sequence for encoding "UTF8": 0xff'