type cast from bytea to varchar or whatever

Поиск
Список
Период
Сортировка
От Michael Monnerie
Тема type cast from bytea to varchar or whatever
Дата
Msg-id 200909101037.20571@zmi.at
обсуждение исходный текст
Ответы Re: type cast from bytea to varchar or whatever
Список pgsql-admin
Dear list,

in dbmail there's a query that worked until postgresql 8.2 (i stripped
the unneeded parts for other tables):

SELECT k.messageblk FROM dbmail_messageblks k WHERE  k.messageblk ILIKE
'%multipart/encrypted%';

In 8.3, you get an error

[ERROR:  operator does not exist: bytea ~~* unknown LINE 1: ...55) ILIKE
'%multipart/encrypted%' OR k.messageblk ILIKE '%mu...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You
might need to add explicit type casts.

OK, but how to cast that? messageblk is of type "bytea", so I can't use
these:

SELECT k.messageblk FROM dbmail_messageblks k WHERE  k.messageblk ILIKE
'%multipart/encrypted%'::bytea;
SELECT k.messageblk FROM dbmail_messageblks k WHERE
k.messageblk::varchar ILIKE '%multipart/encrypted%';

any ideas?

(It should just convert, in case of special chars ignore them. The
contect are mails, so normally text. Don't care about non-ascii here.)

mfg zmi
--
// Michael Monnerie, Ing.BSc    -----      http://it-management.at
// Tel: 0660 / 415 65 31                      .network.your.ideas.
// PGP Key:         "curl -s http://zmi.at/zmi.asc | gpg --import"
// Fingerprint: AC19 F9D5 36ED CD8A EF38  500E CE14 91F7 1C12 09B4
// Keyserver: wwwkeys.eu.pgp.net                  Key-ID: 1C1209B4


Вложения

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

Предыдущее
От: Verna Violet
Дата:
Сообщение: RE
Следующее
От: Nicolas Michel
Дата:
Сообщение: Changing character set of existing databases