first of all I would like to thank all you hard-working postgresql JDBC hackers: I have been using your work for quite a while, and I appreciate what you do.
Now the bad news: I believe I have found a bug in the pgsql jdbc driver regarding read access of BLOBs. According to Sun's JDBC documentation, BLOBs are 1-based, but the driver makes the assumption they are 0-based. Here is the excerpt from javadoc:
Retrieves all or part of the BLOB value that this Blob object represents, as an array of bytes. This byte array contains up to length consecutive bytes starting at position pos.
Parameters:
pos - the ordinal position of the first byte in the BLOB value to be extracted; the first byte is at position 1 length - the number of consecutive bytes to be copied
After patching org/postgresql/jdbc2/AbstractJdbc2Blob.java (I am using the 8.0 311 sources) as follows: