Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux