Re: type cast from bytea to varchar or whatever

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: type cast from bytea to varchar or whatever
Дата
Msg-id 23806.1252594642@sss.pgh.pa.us
обсуждение исходный текст
Ответ на type cast from bytea to varchar or whatever  (Michael Monnerie <michael.monnerie@is.it-management.at>)
Ответы Re: type cast from bytea to varchar or whatever  (Michael Monnerie <michael.monnerie@is.it-management.at>)
Список pgsql-admin
Michael Monnerie <michael.monnerie@is.it-management.at> writes:
> 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

There has *never* been a Postgres release that accepted bytea ILIKE
something.  I'm not sure what you were really doing before, but that
wasn't it.

You could possibly get what you want by explicitly casting the bytea
value to text.  But since that would have been needed (and was not
available) in earlier versions too, I'm a bit mystified by your claim
that this used to work.

I wouldn't really recommend relying on the cast to text, either,
as that has significant probability of not doing what you want
in 8.5 and above :-(.  CVS HEAD does this:

regression=# select 'abcd'::bytea::text;
    text
------------
 \x61626364
(1 row)


            regards, tom lane

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

Предыдущее
От: raghu ram
Дата:
Сообщение: Re: Changing character set of existing databases
Следующее
От: Kenneth Banyas
Дата:
Сообщение: How to mask password when using ALTER USER syntax in psql.