Search Postgresql Archives

Re: Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column

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

 



On Thu, Jan 21, 2010 at 11:54:32AM -0800, Alan Millington wrote:
> Today for the first time since upgrading to Postgres 8.4.1 I tried
> out part of the code which inserts some binary data into a table. The
> insert failed with the error "invalid byte sequence for encoding
> UTF8". That is odd, because the column into which the insert was made
> is of type bytea: the data is meant to be binary data, not
> UTF8-encoded Unicode.

Inserting in bytea needs an extra level of escaping when the parameters
are sent inline. See

http://www.postgresql.org/docs/8.4/interactive/datatype-binary.html

> When I was using Postgres 8.1.4 the same code worked. My code, the
> mxODBC code and the driver are all unaltered: only the Postgres
> version has changed.. Is there something I can tweak to get it to
> work on Postgres 8.4.1?

Very odd. The syntax for this hasn't changed in a long time. And I
would have thought you'd be sending your paramters out of line anyway.
Can you check that?

Hope this helps,
-- 
Martijn van Oosterhout   <kleptog@xxxxxxxxx>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.

Attachment: signature.asc
Description: Digital signature


[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