Skip site navigation (1) Skip section navigation (2)

Search content within a bytea field

From: Damiano Bolzoni <damiano(dot)bolzoni(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Search content within a bytea field
Date: 2009-08-30 20:33:00
Message-ID: 6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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!

Responses

pgsql-jdbc by date

Next:From: Sylvain LerouxDate: 2009-08-30 21:51:51
Subject: Re: Search content within a bytea field
Previous:From: Brett HendersonDate: 2009-08-30 06:24:43
Subject: Re: Prepared Statement Query Planning

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group