pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Kevin Murphy <murphy@genome.chop.edu>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Wish list
Date: Thu, 30 Jun 2005 01:38:56 +1200
Message-ID: <42C2A470.2010804@opencloud.com> (raw)
In-Reply-To: <42C295F5.7080902@genome.chop.edu>
References: <42C19D1D.30809@genome.chop.edu>
	<200506281455.09688.cservin@cromagnon.com>
	<42C295F5.7080902@genome.chop.edu>

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



view thread (2+ messages)

Message-ID: <42C2A470.2010804@opencloud.com>
Permalink:  ../42C2A470.2010804@opencloud.com/
Also on:    postgresql.org/message-id/42C2A470.2010804@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, murphy@genome.chop.edu
  Subject: Re: Wish list
  In-Reply-To: <42C2A470.2010804@opencloud.com>
  References: <42C19D1D.30809@genome.chop.edu> <200506281455.09688.cservin@cromagnon.com> <42C295F5.7080902@genome.chop.edu> <42C2A470.2010804@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox