More on updates with first() vs absolute() - Mailing list pgsql-jdbc

From Rich Cullingford
Subject More on updates with first() vs absolute()
Date
Msg-id 3E64A5C8.7050201@sysd.com
Whole thread Raw
Responses Re: More on updates with first() vs absolute()
List 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@sysd.com


pgsql-jdbc by date:

Previous
From: Ian McFarland
Date:
Subject: Closing one connection closes all connections?
Next
From: Ian McFarland
Date:
Subject: Closing one connection closes all connections?