X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8B4CA5297E for ; Wed, 29 Jun 2005 10:39:00 -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 60767-05 for ; Wed, 29 Jun 2005 13:38:55 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id DA06C529D6 for ; Wed, 29 Jun 2005 10:38:53 -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 1DncmG-0007xD-Q4; Thu, 30 Jun 2005 01:38:56 +1200 Message-ID: <42C2A470.2010804@opencloud.com> Date: Thu, 30 Jun 2005 01:38:56 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Murphy Cc: pgsql-jdbc@postgresql.org Subject: Re: Wish list References: <42C19D1D.30809@genome.chop.edu> <200506281455.09688.cservin@cromagnon.com> <42C295F5.7080902@genome.chop.edu> In-Reply-To: <42C295F5.7080902@genome.chop.edu> 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.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/157 X-Sequence-Number: 13119 Kevin Murphy wrote: > it would be nice if the JDBC driver could somehow expose the > functionality to do the quoting and escaping required in steps 2 and 3 > without ever requiring a database connection. > > I know it's not the driver's main line of business, but since it is able > to do these things anyway (in PreparedStatement.toString), and they are > useful but non-trivial to do properly, why not expose the functionality? Uh, PreparedStatement.toString() *doesn't* necessarily produce correctly quoted queries; the PostgreSQL driver implementation produces a query string by blindly substituting parameter values with no escaping. It's more of a debugging tool than anything else. At the protocol level, the driver isn't escaping strings anyway because they're being passed separately to the query in a Bind message rather than embedded in the query string itself. Also, the plans for post-8.1 string escaping mean that you will need to know what version of the server you are talking to (or something equivalent via a read-only GUC) to know which type of escaping is correct.. it's hard to see how that works without a database connection. -O