bytea -> text

From: Baldur Norddahl <bbn-pgsql(dot)general(at)clansoft(dot)dk>
To: pgsql-general(at)postgresql(dot)org
Subject: bytea -> text
Date: 2003-12-02 19:37:14
Message-ID: 1070393834.3fcce9ea117d5@dark.clansoft.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I need to do something like this:

select * from sms where message ilike 'foo%';

Message is a bytea field with UTF-8 content. The charset is actually not
important for me, it would be enough if it could just treat it as us ascii. The
statement does not work because postgresql can not convert bytea to text. But
this works:

select * from sms where message like 'foo%';

Seems like "like" knows how to convert bytea to text, but I can not find any
generic function that does this convertation so I can use it with ilike (or
regexp).

Is there any reasonable easy way for me to do case insensitive matching on that
bytea field?

Thanks,

Baldur

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jan Wieck 2003-12-02 19:58:21 Re: Triggers, Stored Procedures, PHP. was: Re: PostgreSQL
Previous Message Jan Wieck 2003-12-02 19:23:23 Re: Feature Request for 7.5