From: Damiano Bolzoni <damiano.bolzoni@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: Search content within a bytea field
Date: Sun, 30 Aug 2009 22:33:00 +0200
Message-ID: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com> (raw)
Hi all,
I'm trying to search for some content within a bytea field. My
PreparedStatement looks like this:
SELECT id FROM mytable WHERE myfield LIKE ?
Now, when I execute a
ps.setString(1, "%" + value + "%")
where 'value' is the value I want to search for, the PS becomes
SELECT id FROM mytable WHERE myfield LIKE %VALUE%
and the query clearly fails ("operator does not exist: bytea ~~
character varying"). Now, my question is....why? What am I doing
wrong?
Thanks for you help!
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: damiano.bolzoni@gmail.com
Subject: Re: Search content within a bytea field
In-Reply-To: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com>
References: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox