Re: oid as long type - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: oid as long type
Date
Msg-id Pine.BSO.4.61.0602081158340.24353@leary.csoft.net
Whole thread Raw
In response to oid as long type  (Ryan Li <rleeuk@yahoo.com>)
Responses Re: oid as long type  (Mark Lewis <mark.lewis@mir3.com>)
Re: oid as long type  (Markus Schaber <schabi@logix-tt.com>)
List pgsql-jdbc

On Wed, 8 Feb 2006, Ryan Li wrote:

> What's the reason of using int rather than long for the large object
> oid? I am experiencing a problem where the database server is generating
> oids exceeding the size for a Java int, and got
> "org.postgresql.util.PSQLException: Bad value for type int". Could this
> be solve by making org.postgresql.largeobject.LargeObject.oid a long
> type and make corresponding changes to the source tree?
>

The use of int is a historical artifact, but the problem is that we can't
change the API without requiring clients to make code changes for some
methods.  We could add duplicate method signatures that take long for the
oid types, but the problem is methods like LargeObject.getOID() and
LargeObjectManager.create() return int and these cannot be changed to long
without adjustments to the calling code.  Additionally changes would be
required to the fastpath infrastructure to send and receive longs which
would be complicated by the fact that oids are really unsigned int4, not
int8.

So this is a known problem, but one we've generally avoided dealing with
because few people actually bump into it.  I suppose we could add the new
method signatures and add new methods like getLongOID and only bail out
when code called the old ones with values to be to be represented by an
int.  I'll put it on my todo list, but it's not real close to the top.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: oid as long type
Next
From: Mark Lewis
Date:
Subject: Re: oid as long type