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 2A59CDA929 for ; Mon, 21 Nov 2005 22:43:55 -0400 (AST) 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 54299-10 for ; Tue, 22 Nov 2005 02:43:58 +0000 (GMT) X-Greylist: delayed 03:06:20.635698 by SQLgrey- Received: from svr2.postgresql.org (svr2.postgresql.org [65.19.161.25]) by svr1.postgresql.org (Postfix) with ESMTP id 69011DA4D8 for ; Mon, 21 Nov 2005 22:43:52 -0400 (AST) Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by svr2.postgresql.org (Postfix) with ESMTP id B0100F0B50 for ; Mon, 21 Nov 2005 23:37:33 +0000 (GMT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 21 Nov 2005 15:37:26 -0800 Subject: Re: Can PostgreSQL do data type automated casting in From: Mark Lewis To: Kris Jurka Cc: Tjioe Ai Xin , pgsql-jdbc@postgresql.org In-Reply-To: References: <200511211718.26679.xinxincute@gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Mon, 21 Nov 2005 15:37:26 -0800 Message-Id: <1132616246.4154.10.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-22) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.001 required=5 tests=[UNPARSEABLE_RELAY=0.001] X-Spam-Score: 0.001 X-Spam-Level: X-Archive-Number: 200511/143 X-Sequence-Number: 14241 Here's a thought; do you think it's feasible to detect cases where the protocol=3 driver throws an error due to invalid or ambiguous typing issues when the protocol=2 driver would just do the expected thing? Instead of throwing the error back to the user, could the driver then issue a 'describe statement' call, use the result to disambiguate the parameter settings, and re-issue the call? It increases the overhead but only for the error cases, and the result could be cached to avoid repeating that overhead. I haven't done any hacking in the driver yet, so maybe it would be too much of a pain to implement to justify any possible gains. -- Mark Lewis On Mon, 2005-11-21 at 18:08 -0500, Kris Jurka wrote: > > On Mon, 21 Nov 2005, Tjioe Ai Xin wrote: > > > > > My code is like this: I have query: "Select count(*) / paramPage from > > tblFirst where condition"; The paramPage were filled from parameter > > which I specified as string data type. So I using setString method for > > my prepared statement for passing paramPage value. When I'm using the > > old jdbc driver pg74jdbc3.jar, I got no problem at all. But when I try > > to upgrade my PostgreSQL to 8.0.3. I got problem data type error. > > > > Can PostgreSQL do data type automated casting in prepared statement again? > > So I do not need change my code :) > > > > Yes, and no. You can restore the old behavior by adding > ?protocolVersion=2 to your connection URL, but using the older protocol > also means some new features and performance gains will be unavailable to > you. > > Kris Jurka > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: explain analyze is your friend