More on updates with first() vs absolute()

From: Rich Cullingford <rculling(at)sysd(dot)com>
To: pgsql-jdbc <pgsql-jdbc(at)postgresql(dot)org>
Subject: More on updates with first() vs absolute()
Date: 2003-03-04 13:10:32
Message-ID: 3E64A5C8.7050201@sysd.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Good morning,
Yesterday I reported a crash in updateRow() when preceded by an
absolute(1) positioning call, when preceding it with first() worked. It
now seems the DB update was happening OK; the crash was a null pointer
exception at the line:

rowBuffer[columnIndex] =
connection.getEncoding().encode(String.valueOf(valueObject));

of updateRowBuffer(). It appears the rowBuffer isn't being initialized
properly, and, sure enough, when you compare first() with absolute(),
the former has:

rowBuffer = new byte[this_row.length][];
System.arraycopy(this_row, 0, rowBuffer, 0,
this_row.length);

while the latter does not. Adding the initialization cures the crash.
There might be other locations needing the same patch.

If this is an acceptable patch, I'll be happy to submit it if someone
tells me how. (It looks like a cvs diff to pgsql-jdbc is the desired
way, but I'm not clear how to do that: do I start with the current
pg-snapshot or something else?)

Rich Cullingford
System Detection, Inc.
5 W 19th St, NYC, NY 10010
rculling(at)sysd(dot)com

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Sangyoon Oh 2003-03-04 18:50:08 Return Type Table.
Previous Message Ian McFarland 2003-03-04 10:34:35 Closing one connection closes all connections?