Bytea misconceptions

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Bytea misconceptions
Дата
Msg-id Pine.LNX.4.44.0302191235290.1714-100000@peter.localdomain
обсуждение исходный текст
Ответы Re: Bytea misconceptions  (Joe Conway <mail@joeconway.com>)
Re: Bytea misconceptions  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
The bytea type seems to be liable to character set conversions to the
effect that it falsifies the stored data.

Example:  Create a cluster with non-C CTYPE, create a LATIN1 database,
create a table with a bytea column, and store something with non-ASCII
characters in it.  Then change the client encoding (to UNICODE, say) and
read the data.  I stored 'ätsch bätsch' and got 'Àtsch bÀtsch', which is
not a suitable result for bytea data.

The bytea output function uses isprint() to determine which characters not
to escape, which fails to give at least the documented results in most
locales.  In general, the only safe solution would be to escape *all* byte
values on output.  Then the client can reconstruct the byte sequence based
on the character entities in the delivered string and does not have to
rely on the character codes staying the same during the conversion.
(Alternatively, we do not pass bytea values through the character set
conversion, but that might be unfeasible for other reasons.)

--
Peter Eisentraut   peter_e@gmx.net



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

Предыдущее
От: Dave Cramer
Дата:
Сообщение: request for sql3 compliance for the update command
Следующее
От: Kevin Brown
Дата:
Сообщение: Re: location of the configuration files