Re: UTF-8 for bytea

Поиск
Список
Период
Сортировка
От Marko Kreen
Тема Re: UTF-8 for bytea
Дата
Msg-id CACMqXCKSzpxjL00v5G-j1r6vkNRnfsCm+ZdemaWjWRX=_wSzmA@mail.gmail.com
обсуждение исходный текст
Ответ на UTF-8 for bytea  (Robert James <srobertjames@gmail.com>)
Список pgsql-general
On Thu, Nov 3, 2011 at 4:34 AM, Robert James <srobertjames@gmail.com> wrote:
> When trying to INSERT on Postgres (9.1) to a bytea column, via E''
> escaped strings, I get the strings rejected because they're not UTF8.
> I'm confused, since bytea isn't for strings but for binary.  What
> causes this? How do I fix this? (I know that escaped strings is not
> the best way for binary data, but this is what I'm stuck with for now
> - it's a legacy system which I need to maintain.)

Because the query needs to be utf8.  So you need to escape
any non-ascii chars in it.  Also keep in mind that bytea is double-quoted.
See the docs for details.

--
marko

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

Предыдущее
От: Venkat Balaji
Дата:
Сообщение: : failed: ERROR: could not open file "base/44620/972355": No such file or directory
Следующее
От: Siva Palanisamy
Дата:
Сообщение: Performance issue during multiple insertions