Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 44EEC632CD1 for ; Sun, 30 Aug 2009 17:33:10 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 49210-08 for ; Sun, 30 Aug 2009 20:33:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mail.postgresql.org (Postfix) with ESMTP id 511F46328E6 for ; Sun, 30 Aug 2009 17:33:02 -0300 (ADT) Received: by bwz2 with SMTP id 2so2450155bwz.19 for ; Sun, 30 Aug 2009 13:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=h1VQjJMEKS/IJyUAFHBh0HJgCrYNGiY7tn31I/4B9EU=; b=WsSsDRTosf5f6aNYMzn2aQu2FiebsxpV1rj6VuYh8Xhwn3rgP8ArNpVY5MfQRAXd4S 7cS7vZXevnXeM9PCCbvX+mmlzU9emA0Qpu//zORxycEmv2D2OyjQ7Kku7g+5kKBFDGLL Hfl8rOw1+JfxZtpt/2y7McjNHKZcKEk0dbljo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=BYhMwowHpV9YWnua1bj7/jtwIRCMSv0BzuF05Vl/6B/owE8tsH6QUY741Hr+SU6zcq k93bfEfnh+TvudkD2F7P2GtBntGc0NNQ/u3LU43twMLXt1bBQZPfsDXhS1o0DEsmel2E rMZK/r25GApvHxzmxmjBLZb5Gd8ikGGAIGQTo= MIME-Version: 1.0 Received: by 10.204.24.130 with SMTP id v2mr3527073bkb.33.1251664380245; Sun, 30 Aug 2009 13:33:00 -0700 (PDT) Date: Sun, 30 Aug 2009 22:33:00 +0200 Message-ID: <6fb522db0908301333o3bfeb6e9l5c2ad9dd04308e18@mail.gmail.com> Subject: Search content within a bytea field From: Damiano Bolzoni To: pgsql-jdbc@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.11 tagged_above=-10 required=5 tests=BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 200908/89 X-Sequence-Number: 19938 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!