X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AE370D7BC7 for ; Thu, 29 Sep 2005 20:22:16 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 01593-08 for ; Thu, 29 Sep 2005 23:22:13 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr1.postgresql.org (Postfix) with ESMTP id 07CF1D6F5D for ; Thu, 29 Sep 2005 20:22:13 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EL7jB-0003nY-Sy; Fri, 30 Sep 2005 11:22:14 +1200 Message-ID: <433C7725.1040707@opencloud.com> Date: Fri, 30 Sep 2005 11:22:13 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Russell Francis Cc: pgsql-jdbc@postgresql.org Subject: Re: queries against CIDR fail against 8.0.3? References: <433BE38F.3080605@ev.net> In-Reply-To: <433BE38F.3080605@ev.net> X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200509/142 X-Sequence-Number: 13927 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