Обсуждение: Large Objects with OID > 2147483647
In a posting to the newsgroup comp.databases.postgresql, somebody has complained that he gets org.postgresql.util.PSQLException: Bad value for type int : 2338491788. when he tries to access a BLOB. The problem is new for the poster, it used to work. This looks like a bug in the driver to me: In the driver source code, I see that the OID is treated as 'int', which according to http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html is a 4 byte signed integer, while OIDs are 4 byte unsigned integers. So accessing Large Objects with OID > 2147483647 as BLOB will not work, right? I think that 'long' would be more appropriate than 'int'. Is this problem known? Yours, Laurenz Albe
On Mon, 11 Dec 2006, Albe Laurenz wrote: > In the driver source code, I see that the OID is treated as 'int', > > So accessing Large Objects with OID > 2147483647 as BLOB will not > work, right? I think that 'long' would be more appropriate than 'int'. > > Is this problem known? > Yes, see the thread starting here: http://archives.postgresql.org/pgsql-jdbc/2006-02/threads.php#00052 Two solutions were proposed, neither of which have been implemented. Kris Jurka
On Mon, 11 Dec 2006, Albe Laurenz wrote: > In a posting to the newsgroup comp.databases.postgresql, > somebody has complained that he gets > > org.postgresql.util.PSQLException: Bad value for type int : 2338491788. > > when he tries to access a BLOB. > The problem is new for the poster, it used to work. > > This looks like a bug in the driver to me: > In the driver source code, I see that the OID is treated as 'int', > which according to > http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html > is a 4 byte signed integer, while OIDs are 4 byte unsigned integers. > > So accessing Large Objects with OID > 2147483647 as BLOB will not > work, right? I think that 'long' would be more appropriate than 'int'. > > Is this problem known? > I have put a fix into CVS for 8.1, 8.2 and head drivers that stores the OIDs as longs insteads of ints. Kris Jurka
>> So accessing Large Objects with OID > 2147483647 as BLOB will not >> work, right? I think that 'long' would be more appropriate than 'int'. > > I have put a fix into CVS for 8.1, 8.2 and head drivers that stores the > OIDs as longs insteads of ints. Cool, thank you! Yours, Laurenz Albe