pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sylvain Leroux <sl20@wanadoo.fr>
Cc: pgsql-jdbc@postgresql.org
Cc: Damiano Bolzoni <damiano.bolzoni@gmail.com>
Subject: Re: Search content within a bytea field
Date: Sun, 30 Aug 2009 18:58:49 -0400
Message-ID: <4017.1251673129@sss.pgh.pa.us> (raw)
In-Reply-To: <4A9AF477.5040706@wanadoo.fr>
References: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com>
	<4A9AF477.5040706@wanadoo.fr>

Sylvain Leroux <sl20@wanadoo.fr> writes:
> It seems to me that the problem is comming from the BYTEA type, not from 
> the prepared statement by itself: As far as I know the only operator 
> supported by BYTEA is concatenation. You can't even compare two BYTEA 
> for (in)equality - even less using the LIKE operator.

Nonsense ...

regression=# select oid::regoperator from pg_operator where oprleft = 'bytea'::regtype or oprright = 'bytea'::regtype;
       oid        
------------------
 =(bytea,bytea)
 <>(bytea,bytea)
 <(bytea,bytea)
 <=(bytea,bytea)
 >(bytea,bytea)
 >=(bytea,bytea)
 ~~(bytea,bytea)
 !~~(bytea,bytea)
 ||(bytea,bytea)
(9 rows)

But this does point out the problem: LIKE (a/k/a ~~) on a bytea wants
a bytea on the righthand side, not text or varchar.  So setString is
the wrong thing to use.

			regards, tom lane



view thread (13+ messages)  latest in thread

Message-ID: <4017.1251673129@sss.pgh.pa.us>
Permalink:  ../4017.1251673129@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4017.1251673129@sss.pgh.pa.us

 · 

reply

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: tgl@sss.pgh.pa.us, sl20@wanadoo.fr, damiano.bolzoni@gmail.com
  Subject: Re: Search content within a bytea field
  In-Reply-To: <4017.1251673129@sss.pgh.pa.us>
  References: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com> <4A9AF477.5040706@wanadoo.fr> <4017.1251673129@sss.pgh.pa.us>

* 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