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

Поиск
Список
Период
Сортировка
Искать
От
Martijn van Oosterhout
Тема
Re: Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column
Дата
Msg-id
20100122001312.GB22947@svana.org
Ответ на
Список
Дерево обсуждения
Re: Error "invalid byte sequence for encoding UTF8" on insert into BYTEA column Alan Millington <admillington@yahoo.co.uk>
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      http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while 
> boarding. Thank you for flying nlogn airlines.
В списке pgsql-general по дате отправления
От: Andrej
Дата:
Сообщение: Re: array element replace ?
От: Greg Smith
Дата:
FAQ