pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Mikko Tiihonen <mikko.tiihonen@iki.fi>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Binary protocol patch v7
Date: Sun, 18 Feb 2007 22:03:52 -0500 (EST)
Message-ID: <Pine.BSO.4.64.0702182148200.18728@leary.csoft.net> (raw)
In-Reply-To: <Pine.BSO.4.64.0701071439120.17400@leary2.csoft.net>
References: <1168196101.6236.25.camel@mokki.local>
	<Pine.BSO.4.64.0701071439120.17400@leary2.csoft.net>



On Sun, 7 Jan 2007, Kris Jurka wrote:

> On Sun, 7 Jan 2007, Mikko Tiihonen wrote:
>
>> Just to remind you that the I updated the patches for sending receiving
>> columns in v3 binary format are available at:
>> http://mokki.dyndns.org/~mtiihone/postgresql/binarytransfer/
>> 
>
> I was actually looking at the v7 patch earlier this week, specifically 
> looking at the conversion code.  To try and throw some of the toughest test 
> cases at it I modified the timestamp and time zone test code like 
> k1-timestamp-test.patch.  When running the tests with a 
> build.local.properties including binaryTransfer=true and preparethreshold=1 
> this test fails.
>
> So I thought about ways to get more testing without having to rewrite every 
> single regression test.  I'm not suggesting committing any of this code, but 
> it's just something I hacked together to try more cases.
>

With the attached patch and binaryTransfer=true and preparethreshold=1 in 
build.local.properties I was able to run the regression tests completely 
and got a number of failures.

1) DatabaseMetaData creates ResultSets by sometimes pulling raw bytes out 
of another ResultSet, so it needs to also pass the binary flag to the new
ResultSet.

2) A number of failures in date/time tests.  It seems to have 
some problems with time zones.  Also, conversion to strings
should result in something identical to the text format.

3) There's also a couple of fake failures due to the methodology used. 
testUpdateStreams and testHoldableResultSet fail only because of the 
changes I made.

Kris Jurka

Attachments:

test-binary.patch (text/plain, 4.4K) download Binary files origbinary/org/postgresql/core/.QueryExecutor.java.swp and binary/org/postgresql/core/.QueryExecutor.java.swp differ Binary files origbinary/org/postgresql/jdbc2/.AbstractJdbc2ResultSet.java.swp and binary/org/postgresql/jdbc2/.AbstractJdbc2ResultSet.java.swp differ diff -rcN origbinary/org/postgresql/jdbc2/AbstractJdbc2Statement.java binary/org/postgresql/jdbc2/AbstractJdbc2Statement.java *** origbinary/org/postgresql/jdbc2/AbstractJdbc2Statement.java 2007-02-18 19:37:52.000000000 -0700 --- binary/org/postgresql/jdbc2/AbstractJdbc2Statement.java 2007-02-18 19:12:04.000000000 -0700 *************** *** 233,238 **** --- 233,248 ---- throw new PSQLException(GT.tr("Can''t use query methods that take a query string on a PreparedStatement."), PSQLState.WRONG_OBJECT_TYPE); + clearWarnings(); + PreparedStatement ps = connection.prepareStatement(p_sql, resultsettype, concurrency); + ps.setMaxFieldSize(getMaxFieldSize()); + ps.setFetchSize(getFetchSize()); + ps.setFetchDirection(getFetchDirection()); + ResultSet rs = ps.executeQuery(); + // ps.close(); + return rs; + + /* if (!executeWithFlags(p_sql, 0)) throw new PSQLException(GT.tr("No results were returned by the query."), PSQLState.NO_DATA); *************** *** 241,246 **** --- 251,257 ---- PSQLState.TOO_MANY_RESULTS); return (ResultSet)result.getResultSet(); + */ } /* *************** *** 451,456 **** --- 462,472 ---- if (concurrency != ResultSet.CONCUR_READ_ONLY) flags |= QueryExecutor.QUERY_NO_BINARY_TRANSFER; + + int flags2 = flags | QueryExecutor.QUERY_DESCRIBE_ONLY; + StatementResultHandler handler2 = new StatementResultHandler(); + connection.getQueryExecutor().execute(queryToExecute, queryParameters, handler2, 0, 0, flags2); + StatementResultHandler handler = new StatementResultHandler(); result = null; connection.getQueryExecutor().execute(queryToExecute, diff -rcN origbinary/org/postgresql/test/jdbc2/ConnectionTest.java binary/org/postgresql/test/jdbc2/ConnectionTest.java *** origbinary/org/postgresql/test/jdbc2/ConnectionTest.java 2005-11-23 19:31:43.000000000 -0700 --- binary/org/postgresql/test/jdbc2/ConnectionTest.java 2007-02-18 19:42:41.000000000 -0700 *************** *** 68,73 **** --- 68,74 ---- stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); assertNotNull(stat); stat.close(); + TestUtil.closeDB(conn); } /* *************** *** 88,93 **** --- 89,95 ---- stat = conn.prepareStatement(sql, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); assertNotNull(stat); stat.close(); + TestUtil.closeDB(conn); } /* diff -rcN origbinary/org/postgresql/test/jdbc2/ResultSetTest.java binary/org/postgresql/test/jdbc2/ResultSetTest.java *** origbinary/org/postgresql/test/jdbc2/ResultSetTest.java 2005-11-23 19:31:43.000000000 -0700 --- binary/org/postgresql/test/jdbc2/ResultSetTest.java 2007-02-18 19:39:39.000000000 -0700 *************** *** 170,183 **** //it should apply only to binary and char/varchar columns rs.next(); assertEquals("12345", rs.getString(1)); ! assertEquals("12345", new String(rs.getBytes(1))); //max should apply to the following since the column is //a varchar column rs = stmt.executeQuery("select * from teststring"); rs.next(); assertEquals("12", rs.getString(1)); ! assertEquals("12", new String(rs.getBytes(1))); } public void booleanTests(boolean useServerPrepare) throws SQLException --- 170,183 ---- //it should apply only to binary and char/varchar columns rs.next(); assertEquals("12345", rs.getString(1)); ! // assertEquals("12345", new String(rs.getBytes(1))); //max should apply to the following since the column is //a varchar column rs = stmt.executeQuery("select * from teststring"); rs.next(); assertEquals("12", rs.getString(1)); ! // assertEquals("12", new String(rs.getBytes(1))); } public void booleanTests(boolean useServerPrepare) throws SQLException

view thread (3+ messages)

Message-ID: <Pine.BSO.4.64.0702182148200.18728@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0702182148200.18728@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0702182148200.18728@leary.csoft.net

 ·  · 

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: books@ejurka.com, mikko.tiihonen@iki.fi
  Subject: Re: Binary protocol patch v7
  In-Reply-To: <Pine.BSO.4.64.0702182148200.18728@leary.csoft.net>
  References: <1168196101.6236.25.camel@mokki.local> <Pine.BSO.4.64.0701071439120.17400@leary2.csoft.net> <Pine.BSO.4.64.0702182148200.18728@leary.csoft.net>

* 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