How to select using LIKE with bytea?

From: David Ford <david(at)blue-labs(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: How to select using LIKE with bytea?
Date: 2001-09-04 02:43:57
Message-ID: 3B943FED.4080501@blue-labs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

First a row, then the question.

archives=# select * from archives;
listname | received_date | header_date | subject
| author
|
headers
|
body

----------+------------------------+------------------------+----------+--------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
admin | 2001-09-03 22:37:19-04 | 2001-09-03 15:24:29-04 | Need Web |
Cheap(at)mail(dot)web(dot)net | From Cheap(at)mail(dot)web(dot)net Mon Sep 3 11:40:22
2001\015\012Received: from CheapWebPager.com Newsletter\015\012Date:
Mon, 03 Sep 01 14:24:29 EST\015\012From: Cheap(at)mail(dot)web(dot)net\015\012To:
webmaster(at)kalifornia(dot)com\015\012Subject: Need Web\015\012 | This is test
text. a\\'one\\'b\012more test text. left slash \\\\, right slash
/.\012let\\'s embed a (\\\000\\\000) NULL. This should not break
things.\012--no more--\012-d\012
(1 row)

archives=# select * from archives where headers like '%To: webmaster%';
ERROR: Unable to identify an operator '~~' for types 'bytea' and 'unknown'
You will have to retype this query using an explicit cast

How should I be writing this so as to match rows where the headers
include 'To: webmaster'?

David

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-09-04 02:49:32 Re: ERROR: int8 conversion to int4 is out of range
Previous Message Robert L Mathews 2001-09-04 02:25:02 Re: Crash in vacuum analyze