Re: JDBC Support for standard_conforming_strings
От | Kris Jurka |
---|---|
Тема | Re: JDBC Support for standard_conforming_strings |
Дата | |
Msg-id | 456AEC4A.4000401@ejurka.com обсуждение исходный текст |
Ответ на | JDBC Support for standard_conforming_strings (Michael Paesold <mpaesold@gmx.at>) |
Ответы |
Re: JDBC Support for standard_conforming_strings
Re: JDBC Support for standard_conforming_strings |
Список | pgsql-jdbc |
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 >
В списке pgsql-jdbc по дате отправления: