pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Eric Schwarzenbach <subscriber@blackbrook.org>
To: pgsql-bugs@postgresql.org
Subject: IN clause on BYTEA column works against table directly but gives error against view
Date: Mon, 27 Dec 2010 14:39:57 -0500
Message-ID: <4D18EB8D.8040407@blackbrook.org> (raw)

I've got a SELECT with a WHERE clause using IN against a BYTEA column 
which works when I'm querying against the table directly. However when I 
substitute an equivalent view in my query (a view made of several inner 
joins which simply carry over that same BYTEA column), I get the error:

operator does not exist: "integer = bytea"

I've googled this error and read how certain syntax against BYTEA which 
worked in older versions of PostgreSQL stopped working at some point 
when some implicit conversion rules were tightened up. I'm not sure of 
the relevance of this to my situation given the change in behavior 
between table vs view.

My query is occurring via JDBC, using a prepared statement, where I'm 
passing a byte array for each parameter in the IN clause, using the 
setObject(int, Object) method.

I've tried this on PostgreSQL versions 8.3.1, and 8.4.5, and have tried 
various versions of the JDBC drivers.

I'll try working around this by having my code create escaped octal 
syntax instead of passing a byte array, or possibly by passing a SQL 
type code. But I thought I should see if anyone had some idea why a 
table vs a view should produce different behavior like this, and if 
there were any other workarounds or caveats about what may be going on 
that I should be aware of...

Regards,

Eric





view thread (2+ messages)  latest in thread

Message-ID: <4D18EB8D.8040407@blackbrook.org>
Permalink:  ../4D18EB8D.8040407@blackbrook.org/
Also on:    postgresql.org/message-id/4D18EB8D.8040407@blackbrook.org

 · 

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-bugs@postgresql.org
  Cc: subscriber@blackbrook.org
  Subject: Re: IN clause on BYTEA column works against table directly but gives error against view
  In-Reply-To: <4D18EB8D.8040407@blackbrook.org>
  References: <4D18EB8D.8040407@blackbrook.org>

* 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