From: Oliver Jowett <oliver@opencloud.com>
To: Russell Francis <rfrancis@ev.net>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: queries against CIDR fail against 8.0.3?
Date: Fri, 30 Sep 2005 11:22:13 +1200
Message-ID: <433C7725.1040707@opencloud.com> (raw)
In-Reply-To: <433BE38F.3080605@ev.net>
References: <433BE38F.3080605@ev.net>
Russell Francis wrote:
> PreparedStatement s = dbConn.prepareStatement(
> "SELECT * FROM institution WHERE ( institution.network >>= ? ) LIMIT 1" );
> s.setObject( 1, (String)request.getRemoteAddr() );
> net.ev.dao.DAOException: ERROR: operator does not exist: cidr >>=
> character varying
You will need to either create a PGobject subclass that returns the
correct typename (cidr), or explicitly cast to cidr in your query:
SELECT * FROM institution WHERE ( institution.network >>= ?::cidr )
LIMIT 1
> Does anyone have any ideas on how to address this issue? Or at least an
> explanation as to why it works in 7.3.9 but not 8.0.3?
The 8.0 drivers type parameters more strongly than earlier drivers due
to a change in the protocol used, so setObject(String) is passing the
parameter explicitly as a 'text' value not as an untyped literal that
gets implicitly casted to cidr. See the archives for more details.
-O
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: oliver@opencloud.com, rfrancis@ev.net
Subject: Re: queries against CIDR fail against 8.0.3?
In-Reply-To: <433C7725.1040707@opencloud.com>
References: <433BE38F.3080605@ev.net> <433C7725.1040707@opencloud.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