encode, lower and 0x8a

Поиск
Список
Период
Сортировка
От Michael Artz
Тема encode, lower and 0x8a
Дата
Msg-id e9c163070701251128i318fa118s5d3d32744082f2d3@mail.gmail.com
обсуждение исходный текст
Ответы Re: encode, lower and 0x8a  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
Perhaps my understanding of the 'encode' function is incorrect, but I
was under the impression that I could do something like:

SELECT lower(encode(bytes, 'escape')) FROM mytable;

as it sounded like (from the manual) that 'encode' would return valid
ASCII, with all the non-ascii bytes hex escaped.  When I have the byte
0x8a, however, I get the error:

ERROR:  invalid byte sequence for encoding "UTF8": 0x8a

I have the sneaking suspicion that I am missing something, so please
correct me if I am wrong.  If I am wrong, is there a better way to
lowercase all the ascii characters in a bytea string?

Here is a simple way to recreate this:

CREATE TABLE mytable (bytes BYTEA);
INSERT INTO mytable VALUES (E'212');
SELECT lower(encode(bytes, 'escape')) FROM mytable;

Thanks
-Mike

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

Предыдущее
От: "Jeremy Haile"
Дата:
Сообщение: Re: Stats collector frozen?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: sequence increment jumps?