Обсуждение: [PATCH] Datatype of OID should be VARBINARY, not INT

Поиск
Список
Период
Сортировка

[PATCH] Datatype of OID should be VARBINARY, not INT

От
Nissim
Дата:
The datatype returned by the ResultSetMetaData for OID should be
VARBINARY, not INT.  Here's a patch for Field.java:

Index: src/interfaces/jdbc/org/postgresql/Field.java
===================================================================
RCS file:
/home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Field.java,v
retrieving revision 1.1
diff -r1.1 Field.java
118c118
<     "int4","oid",
---
>     "int4",
129c129,130
<     "abstime","timestamp"
---
>     "abstime","timestamp",
>     "oid"
141c142
<     Types.INTEGER,Types.INTEGER,
---
>     Types.INTEGER,
152c153,154
<     Types.TIMESTAMP,Types.TIMESTAMP
---
>     Types.TIMESTAMP,Types.TIMESTAMP,
>     Types.VARBINARY


Re: [PATCH] Datatype of OID should be VARBINARY, not INT

От
Tom Lane
Дата:
Nissim <nissim@nksystems.com> writes:
> The datatype returned by the ResultSetMetaData for OID should be
> VARBINARY, not INT.

Uh, why?  There's nothing VAR about it that I can see, and it is
the same size as INT ... at the moment anyway ...
        regards, tom lane


Re: [PATCH] Datatype of OID should be VARBINARY, not INT

От
Nissim
Дата:
Tom Lane wrote:
> 
> Nissim <nissim@nksystems.com> writes:
> > The datatype returned by the ResultSetMetaData for OID should be
> > VARBINARY, not INT.
> 
> Uh, why?  There's nothing VAR about it that I can see, and it is
> the same size as INT ... at the moment anyway ...
> 
>                         regards, tom lane

If you're using it to identify rows then it is used like an int, but if
you're using it to point to a Large Object, the LO is variable size
binary data, right?

We're using it with village: http://www.working-dogs.com/village which
decides which set method of the PreparedStatement to use, based on the
type in the MetaData. If the type returned is INTEGER then it does
setInt, and if the type is BINARY or VARBINARY it does setBytes.  Do you
have a better solution than making the change I sent in the patch?

Will returning VARBINARY as the type of an OID column break anyone elses
apps?
-Nissim


Re: [PATCH] Datatype of OID should be VARBINARY, not INT

От
Tom Lane
Дата:
Nissim <nissim@nksystems.com> writes:
> Tom Lane wrote:
>> 
>> Nissim <nissim@nksystems.com> writes:
>>>> The datatype returned by the ResultSetMetaData for OID should be
>>>> VARBINARY, not INT.
>> 
>> Uh, why?  There's nothing VAR about it that I can see, and it is
>> the same size as INT ... at the moment anyway ...

> If you're using it to identify rows then it is used like an int, but if
> you're using it to point to a Large Object, the LO is variable size
> binary data, right?

The LO may be, but that doesn't make the OID so.  I think you are
confusing two things that should be kept separate.

> Will returning VARBINARY as the type of an OID column break anyone elses
> apps?

Undoubtedly.  Find another way.
        regards, tom lane