Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id C3B659FA2E0 for ; Mon, 27 Nov 2006 09:47:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 91723-05 for ; Mon, 27 Nov 2006 09:47:05 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by postgresql.org (Postfix) with ESMTP id CAD439FA2CA for ; Mon, 27 Nov 2006 09:47:04 -0400 (AST) Received: from [192.168.7.2] (71-208-179-7.hlrn.qwest.net [71.208.179.7]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail63.csoft.net (Postfix) with ESMTP id 76B03F4EB for ; Mon, 27 Nov 2006 08:47:02 -0500 (EST) Message-ID: <456AEC4A.4000401@ejurka.com> Date: Mon, 27 Nov 2006 06:46:50 -0700 From: Kris Jurka User-Agent: Thunderbird 1.5.0.7 (X11/20060928) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: JDBC Support for standard_conforming_strings References: <454E4DA7.8030603@gmx.at> <454FB057.1080000@gmx.at> <45580A6E.2010905@ejurka.com> <45615B73.8050200@gmx.at> <456AE94B.7040409@gmx.at> In-Reply-To: <456AE94B.7040409@gmx.at> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50 X-Spam-Level: X-Archive-Number: 200611/135 X-Sequence-Number: 16177 Another message that did not reach the list because of large patches. I've put the patches here: http://www.ejurka.com/pgsql/patches/standard-strings/ Kris Jurka Michael Paesold wrote: > Here is a new version of my patch (set) implementing support for > standard_conforming_strings. > > There are three patches now, split for easier review: > 01-standard-strings.patch: > the main patch (to be applied first) > 02-metadata-escapes.patch: > updates literal \\ escapes in AbstractJdbc2DatabaseMetaData > 03-testsuite-escapes.patch: > updates literal \\ escapes in the test-suite and expands the > test for string literals for server versions >= 8.2. > > With all three patches applied, the driver passes the test suite against > an 8.2 server with both standard_conforming_strings turned on or off, as > well as connecting using the V2 or V3 protocol. > > Some notes: > - The AbstractJdbc2DatabaseMetaData class made a lot of use of "x LIKE > 'pg\\\\_%'" constructs. With standard_conforming_strings turned off, > this must be written as 'pg\\_%'. Since many of the instances are in > static initialization context, there is no access to that setting, > though. So I changed all of those to "x ~ '^pg_'" (or similar) instead, > which works without escaping. Tom Lane recommended this usage pattern > for the information_schema on hackers, once. So I guess it should be OK > for the JDBC driver, too. > Nevertheless, the changes should be reviewed thoroughly, because some > code paths are only executed for older version of Postgres. > > - The query splitting code now also supports parsing the escaped string > syntax (E''). The parsing code in parseSql and modifyJdbcCall does not > yet. I thought this was of less importance. > Perhaps it could be done more easily by reusing or combining the main > parsing code (the code already has comments suggesting that). Since the > release of 8.2 is imminent, I would prefer to leave it as-is for now and > rather get testing on the more important parts. > > - The V2 query path now uses the E'' escape string syntax for string > constants as soon as a server version >= 8.2 is discovered. This > protects the driver from changes to standard_conforming_strings, which > it cannot detect using the V2 protocol. The escape string syntax is also > used to send bytea data to the server. > > I am currently not aware of any other issues. Comments are welcome, > testing is appreciated. > > Best Regards > Michael Paesold >