Re: [HACKERS] invalidly encoded strings

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: [HACKERS] invalidly encoded strings
Дата
Msg-id 46EC8F48.8050002@dunslane.net
обсуждение исходный текст
Ответы Re: [HACKERS] invalidly encoded strings  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-patches

Tom Lane wrote:
> What I think we'd need to have a complete solution is
>
> convert(text, name) returns bytea
>     -- convert from DB encoding to arbitrary encoding
>
> convert(bytea, name, name) returns bytea
>     -- convert between any two encodings
>
> convert(bytea, name) returns text
>     -- convert from arbitrary encoding to DB encoding
>
> The second and third would need to do a verify step before
> converting, of course.
>
>
>

Here's a patch that implements the above. It actually does the verify
step for all three cases - if that bothers people I can remove it at the
cost of a little code complexity.

It also fixes the "convert ... using ..." case in a similar way (makes
it return a bytea).

On reflection I think we also need to provide length(bytea, name) as has
been suggested, so we can check the length in the foreign encoding of a
bytea we have converted this way. That shouldn't be too difficult to add.

cheers

andrew

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Latest README.HOT
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] invalidly encoded strings