Home > Archive > PostgreSQL JDBC > July 2005 > Re: getObject(<oid>) returns integer instead of LargeObject









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: getObject(<oid>) returns integer instead of LargeObject
Kris Jurka

2005-07-22, 1:24 pm



On Fri, 22 Jul 2005, Marc Herbert wrote:

> Is there some good reason for getObject(<some oid column> ) to return the
> bare oid integer instead of the actual LargeObject handle ?


This makes the assumption that the only use of oids is for large objects.
What if someone wrote SELECT oid,relname FROM pg_class?

Kris Jurka

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Marc Herbert

2005-07-26, 7:23 am

On Fri, Jul 22, 2005 at 01:41:19PM -0500, Kris Jurka wrote:
>
>
> On Fri, 22 Jul 2005, Marc Herbert wrote:
>
>
> This makes the assumption that the only use of oids is for large objects.
> What if someone wrote SELECT oid,relname FROM pg_class?


Thanks for answering.

What would you recommend to unambiguously identify a Blob column in a
arbitrary ResultSet, using only JDBC?

For instance could you trust
Types.BLOB == rs.getMetaData.getColumnType() in every case?
Is there any other way?

Would it depend on the latest version of the driver/database?

Thanks in advance for you help!


PS: why do LOBs seem to use regular oids instead of some other less
ambiguous say, "loid" ?


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Oliver Jowett

2005-07-26, 7:23 am

Marc Herbert wrote:

> What would you recommend to unambiguously identify a Blob column in a
> arbitrary ResultSet, using only JDBC?


I don't think there is any way to do this in general, via JDBC or any
other interface; you need schema-specific knowledge to work out which
oid columns refer to LOs and which refer to a different sort of oid
somewhere else.

The actual LO interface itself just looks like "create LO" -> "ok,
here's an oid identifying it"; there's nothing that ties the column you
happen to use to store that oid to the LO itself. See
http://www.postgresql.org/docs/8.0/...rgeobjects.html for more
details.

For comparison, contrib/vacuumlo assumes that any (non-system-generated)
oid column in the system could potentially reference a LO (in GC-speak
it's a conservative collector).

> PS: why do LOBs seem to use regular oids instead of some other less
> ambiguous say, "loid" ?


It's just an artifact of the implementation AFAIK.

-O

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com