pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert B. Easter <reaster@comptechnews.com>
To: David Wall <d.wall@computer.org>
To: pgsql-interfaces@postgresql.org
Subject: Re: blobs and small binary objects
Date: Wed, 24 Jan 2001 19:13:12 -0500
Message-ID: <0101241913120H.08820@comptechnews> (raw)
In-Reply-To: <94kk45$1rdh$1@news.tht.net>
References: <94kk45$1rdh$1@news.tht.net>

The documentation at www.postgresql.org talks about Large Objects.  Large 
Objects in postgres are not like other data types.  They are like files 
identified by an OID number instead of a file pointer.  Postgres has a set of 
functions that more or less mirror C file IO functions.  Instead of a file 
pointer, you use the OID of the large object with these functions.  When you 
use the function to create a large object, it returns an OID that you use 
from then on to work with it. If you read the docs, an OID is a hidden field 
in every record in all tables and is created automatically by the database.  
Just about every data item created in the database gets an OID number that 
identifies it.

If you are working with JDBC, it has javadoc documentation.  I have it on my 
website:

http://localhost/~reaster/pg_jdbc/
http://localhost/~reaster/pg_jdbc/org/postgresql/largeobject/LargeObjectManager.html

The LargeObjectManager has the functions needed to get started.  Notice how 
the functions take an int OID.  A LargeObject has a function getOID() so you 
can get it when you need to.  To construct a PGBlob object, you need this 
OID. Postgres doesn't actually have SQL BLOB or CLOB datatypes.  The postgres 
JDBC PBblob just implements the JDBC blob interface but it uses the postgres 
large object functions internally.  I guess you can try to make your code 
more portable if you create PGblobs and use that interface in your code.  
When the real BLOB datatype is available, maybe less will have to be changed 
in your code that way.


On Tuesday 23 January 2001 13:56, David Wall wrote:
> I'm new to Postgresql and am trying to figure out how I'd store
> Serializable objects, byte arrays and potentially large binary objects. 
> JDBC has APIs for getObject(), getBytes() and getBlob(), but how do I
> define those attributes inside a table?  I don't see the typical BYTE or
> BINARY or BLOB types.
>
> I know that 7.0.3 still suffers from the 8K row limit, so I'd hope that the
> JDBC library would automatically handle this for me, if I define some small
> objects as byte arrays, and larger objects are blobs.  I saw somewhere a
> type BYTEA (byte array?), but I can't find it in the documentation to know
> if this is a real type, one of the user defined types that's a common
> extension, etc.
>
> Anybody handle these issues yet?
>
> Thanks,
> David

-- 
-------- Robert B. Easter  reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------



view thread (3+ messages)  latest in thread

Message-ID: <0101241913120H.08820@comptechnews>
Permalink:  ../0101241913120H.08820@comptechnews/
Also on:    postgresql.org/message-id/0101241913120H.08820@comptechnews

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: reaster@comptechnews.com, d.wall@computer.org
  Subject: Re: blobs and small binary objects
  In-Reply-To: <0101241913120H.08820@comptechnews>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox