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

Re: queries against CIDR fail against 8.0.3?

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Russell Francis <rfrancis(at)ev(dot)net>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: queries against CIDR fail against 8.0.3?
Date: 2005-09-29 23:22:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Russell Francis wrote:

> PreparedStatement s = dbConn.prepareStatement(
> "SELECT * FROM institution WHERE ( >>=  ? ) 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 ( >>= ?::cidr )

> 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.


In response to


pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-09-29 23:27:10
Subject: Re: Intermittent I/O error?
Previous:From: Kris JurkaDate: 2005-09-29 23:21:12
Subject: Re: "Conversion of interval failed" on PGInterval with

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