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 BC48DDA270 for ; Mon, 21 Nov 2005 20:25:01 -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 05347-02 for ; Tue, 22 Nov 2005 00:25:03 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail63.csoft.net (leary3.csoft.net [63.111.22.74]) by svr1.postgresql.org (Postfix) with SMTP id CA327DA239 for ; Mon, 21 Nov 2005 20:24:58 -0400 (AST) Received: (qmail 16104 invoked by uid 1112); 22 Nov 2005 00:28:00 -0000 Date: Mon, 21 Nov 2005 19:28:00 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Mark Lewis cc: Tjioe Ai Xin , pgsql-jdbc@postgresql.org Subject: Re: Can PostgreSQL do data type automated casting in prepared In-Reply-To: <1132616246.4154.10.camel@archimedes> Message-ID: References: <200511211718.26679.xinxincute@gmail.com> <1132616246.4154.10.camel@archimedes> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/141 X-Sequence-Number: 14239 On Mon, 21 Nov 2005, Mark Lewis wrote: > 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. > There a number of problems with the fallback approach. First, since we've got a server error that will necessitate the transaction be rolled back so we'd have to establish a savepoint before every statement. Then you'd have to detect an error condition as being related to type resolution which isn't really clear. Even if this did work for people it certainly wouldn't be optimal because you could end up doing a lot more work, parsing twice and establishing and rolling back to savepoint, without knowing it. Your application would look like it was working, but it's certainly not how you want it to. Kris Jurka