type cast from bytea to varchar or whatever

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux